< GeeXLab Reference Guide />
> Back to Reference Guide Index
gh_bullet3 library
Description
gh_bullet3 is the module that manages the Bullet Physics engine.
Number of functions: 59
- gh_bullet3.actor_apply_central_force ()
- gh_bullet3.actor_apply_central_impulse ()
- gh_bullet3.actor_apply_torque ()
- gh_bullet3.actor_apply_transform ()
- gh_bullet3.actor_get_transform_mat16 ()
- gh_bullet3.actor_get_transform_pos_qrot ()
- gh_bullet3.actor_clear_forces ()
- gh_bullet3.actor_create_box ()
- gh_bullet3.actor_create_box_v2 ()
- gh_bullet3.actor_create_cylinder ()
- gh_bullet3.actor_create_cylinder_v2 ()
- gh_bullet3.actor_create_mesh ()
- gh_bullet3.actor_create_mesh_v2 ()
- gh_bullet3.actor_create_sphere ()
- gh_bullet3.actor_create_sphere_v2 ()
- gh_bullet3.actor_create_static_plane ()
- gh_bullet3.actor_create_static_plane_v2 ()
- gh_bullet3.actor_get_contact_actor ()
- gh_bullet3.actor_get_activation_state ()
- gh_bullet3.actor_get_angular_speed2 ()
- gh_bullet3.actor_get_angular_velocity ()
- gh_bullet3.actor_get_contact_info ()
- gh_bullet3.actor_get_linear_speed2 ()
- gh_bullet3.actor_get_linear_velocity ()
- gh_bullet3.actor_get_orientation ()
- gh_bullet3.actor_get_position ()
- gh_bullet3.actor_kill ()
- gh_bullet3.actor_set_3d_object ()
- gh_bullet3.actor_set_activation_state ()
- gh_bullet3.actor_set_angular_factor ()
- gh_bullet3.actor_set_angular_velocity ()
- gh_bullet3.actor_set_ccd_params ()
- gh_bullet3.actor_set_collision_margin ()
- gh_bullet3.actor_set_damping ()
- gh_bullet3.actor_set_gravity ()
- gh_bullet3.actor_set_linear_factor ()
- gh_bullet3.actor_set_linear_velocity ()
- gh_bullet3.actor_set_material ()
- gh_bullet3.actor_set_orientation ()
- gh_bullet3.actor_set_position ()
- gh_bullet3.actor_set_sleeping_thresholds ()
- gh_bullet3.actor_update_mass ()
- gh_bullet3.get_version ()
- gh_bullet3.init ()
- gh_bullet3.material_create ()
- gh_bullet3.material_kill ()
- gh_bullet3.material_update ()
- gh_bullet3.scene_add_actor ()
- gh_bullet3.scene_check_contacts ()
- gh_bullet3.scene_create ()
- gh_bullet3.scene_create_sap ()
- gh_bullet3.scene_kill ()
- gh_bullet3.scene_remove_actor ()
- gh_bullet3.scene_reset_all_contacts ()
- gh_bullet3.scene_set_gravity ()
- gh_bullet3.scene_set_solver_num_iterations ()
- gh_bullet3.scene_step_simulation ()
- gh_bullet3.scene_sync_3d_objects ()
- gh_bullet3.terminate ()
actor_apply_central_force
Description
Applies a force to an actor.
Syntax
gh_bullet3.actor_apply_central_force(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: force
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_apply_central_force(actor_id, x, y, z)
actor_apply_central_impulse
Description
Applies an impulse force to an actor.
Syntax
gh_bullet3.actor_apply_central_impulse(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: force
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_apply_central_impulse(actor_id, x, y, z)
actor_apply_torque
Description
Applies a torque to an actor.
Syntax
gh_bullet3.actor_apply_torque(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: torque
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_apply_torque(actor_id, x, y, z)
actor_apply_transform
Description
Apply the transformation matrix of a physics actor to a 3D object. It's a manual physcis/graphics synchronization. Use this function if you don't use scene_sync_3d_objects().
Syntax
gh_bullet3.actor_apply_transform(
actor_id,
o3d_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
- o3d_id [ID]: 3d object identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_apply_transform(actor_id, o3d_id)
actor_get_transform_mat16
Description
Returns the transformation matrix of a physics actor.
Syntax
m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15 = gh_bullet3.actor_get_transform_mat16(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
- m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15 [REAL]: the 16 floats that make the 4x4 matrix
Code sample
m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15 = gh_bullet3.actor_get_transform_mat16(actor_id)
actor_get_transform_pos_qrot
Description
Returns the position and orientation (quaternion) of a physics actor.
Syntax
px, py, pz, qx, qy, qz, qw = gh_bullet3.actor_get_transform_pos_qrot(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
- px, py, pz [REAL]: position
- qx, qy, qz, qw [REAL]: rotation quaternion
Code sample
px, py, pz, qx, qy, qz, qw = gh_bullet3.actor_get_transform_pos_qrot(actor_id)
actor_clear_forces
Description
Clears (resets) all forces that act on an actor.
Syntax
gh_bullet3.actor_clear_forces(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_clear_forces(actor_id)
actor_create_box
Description
Creates a box actor.
Syntax
actor_id = gh_bullet3.actor_create_box(
w, h, d,
x, y, z,
mass,
mat_id
)
Languages
Parameters
- w, h, d [REAL]: dimensions of the box
- x, y, z [REAL]: initial position of the actor
- mass [REAL]: mass (set the mass = 0 for a kinematic actor)
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
actor_id = gh_bullet3.actor_create_box(w, h, d, x, y, z, mass, mat_id)
actor_create_box_v2
Description
Creates a box actor.
Syntax
actor_id = gh_bullet3.actor_create_box_v2(
w, h, d,
x, y, z,
mass,
ix, iy, iz,
mat_id
)
Languages
Parameters
- w, h, d [REAL]: dimensions of the box
- x, y, z [REAL]: initial position of the actor
- mass [REAL]: mass (set the mass = 0 for a kinematic actor)
- ix, iy, iz [REAL]: initial local inertia
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
actor_id = gh_bullet3.actor_create_box_v2(w, h, d, x, y, z, mass, ix, iy, iz, mat_id)
actor_create_cylinder
Description
Creates a cylinder actor.
Syntax
actor_id = gh_bullet3.actor_create_cylinder(
main_axis,
height,
radius,
x, y, z,
mass,
mat_id
)
Languages
Parameters
- main_axis [ENUM]: direction of the main axis: 0 (along X axis), 1 (along Y axis) or 2 (along Z axis)
- height [REAL]: cylinder height
- radius [REAL]: cylinder radius
- x, y, z [REAL]: initial position of the actor
- mass [REAL]: mass (set the mass = 0 for a kinematic actor)
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
actor_id = gh_bullet3.actor_create_cylinder(central_axis, height, radius, x, y, z, mass, mat_id)
actor_create_cylinder_v2
Description
Creates a cylinder actor.
Syntax
actor_id = gh_bullet3.actor_create_cylinder_v2(
main_axis,
height,
radius,
x, y, z,
mass,
ix, iy, iz,
mat_id
)
Languages
Parameters
- main_axis [ENUM]: direction of the main axis: 0 (along X axis), 1 (along Y axis) or 2 (along Z axis)
- height [REAL]: cylinder height
- radius [REAL]: cylinder radius
- x, y, z [REAL]: initial position of the actor
- mass [REAL]: mass (set the mass = 0 for a kinematic actor)
- ix, iy, iz [REAL]: initial local inertia
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
actor_id = gh_bullet3.actor_create_cylinder_v2(central_axis, height, radius, x, y, z, mass, ix, iy, iz, mat_id)
actor_create_mesh
Description
Creates an actor from a mesh.
Syntax
actor_id = gh_bullet3.actor_create_mesh(
mesh_id,
convex,
x, y, z,
mass,
mat_id
)
Languages
Parameters
- mesh_id [ID]: mesh identifier
- convex [BOOLEAN]: convex mesh: 1 (yes) or 0 (no)
- x, y, z [REAL]: initial position of the actor
- mass [REAL]: mass (set the mass = 0 for a kinematic actor)
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
actor_id = gh_bullet3.actor_create_mesh(mesh_id, convex, x, y, z, mass, mat_id)
actor_create_mesh_v2
Description
Creates an actor from a mesh.
Syntax
actor_id = gh_bullet3.actor_create_mesh_v2(
mesh_id,
convex,
x, y, z,
mass,
ix, iy, iz,
mat_id
)
Languages
Parameters
- mesh_id [ID]: mesh identifier
- convex [BOOLEAN]: convex mesh: 1 (yes) or 0 (no)
- x, y, z [REAL]: initial position of the actor
- mass [REAL]: mass (set the mass = 0 for a kinematic actor)
- ix, iy, iz [REAL]: initial local inertia
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
actor_id = gh_bullet3.actor_create_mesh_v2(mesh_id, convex, x, y, z, mass, ix, iy, iz, mat_id)
actor_create_sphere
Description
Creates a sphere actor.
Syntax
actor_id = gh_bullet3.actor_create_sphere(
radius,
x, y, z,
mass,
mat_id
)
Languages
Parameters
- radius [REAL]: sphere radius
- x, y, z [REAL]: initial position of the actor
- mass [REAL]: mass (set the mass = 0 for a kinematic actor)
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
actor_id = gh_bullet3.actor_create_sphere(radius, x, y, z, mass, mat_id)
actor_create_sphere_v2
Description
Creates a sphere actor.
Syntax
actor_id = gh_bullet3.actor_create_sphere_v2(
radius,
x, y, z,
mass,
ix, iy, iz,
mat_id
)
Languages
Parameters
- radius [REAL]: sphere radius
- x, y, z [REAL]: initial position of the actor
- mass [REAL]: mass (set the mass = 0 for a kinematic actor)
- ix, iy, iz [REAL]: initial local inertia
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
actor_id = gh_bullet3.actor_create_sphere_v2(radius, x, y, z, mass, ix, iy, iz, mat_id)
actor_create_static_plane
Description
Creates a static plane actor. This is an infinite plane defined by a plane equation.
Syntax
actor_id = gh_bullet3.actor_create_static_plane(
nx, ny, nz, d,
mat_id
)
Languages
Parameters
- nx, ny, nz, d [REAL]: plane equation
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
nx = 0
ny = 1
nz = 0
d = 0
actor_id = gh_bullet3.actor_create_static_plane(nx, ny, nz, d, mat_id)
actor_create_static_plane_v2
Description
Creates a static plane actor. This is an infinite plane defined by a plane equation.
Syntax
actor_id = gh_bullet3.actor_create_static_plane_v2(
nx, ny, nz,
px, py, pz,
mat_id
)
Languages
Parameters
- nx, ny, nz [REAL]: plane normal vector
- px, py, pz [REAL]: plane position
- mat_id [ID]: material identifier
Return Values
- actor_id [ID]: actor identifier
Code sample
nx = 1
ny = 0
nz = 0
px = 5
py = 0
pz = 0
actor_id = gh_bullet3.actor_create_static_plane_v2(nx, ny, nz, px, py, pz, mat_id)
actor_get_contact_actor
Description
Gets the actor ID of a particular contact.
Syntax
contact_actor_id = gh_bullet3.actor_get_contact_actor(
actor_id,
contact_index
)
Languages
Parameters
- actor_id [ID]: actor identifier
- contact_index [INTEGER]: contact index
Return Values
- contact_actor_id [ID]: ID of the actor in contact
Code sample
num_contacts, x, y, z = gh_bullet3.actor_get_contact_info(actor_id)
for i=0, num_contacts-1 do
contact_actor_id = gh_bullet3.actor_get_contact_actor(actor_id, i)
...
end
actor_get_activation_state
Description
Gets the activation state of an actor.
Syntax
state = gh_bullet3.actor_get_activation_state(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
- state [INTEGER]: activation state (0 or 1)
Code sample
state = gh_bullet3.actor_get_activation_state(actor_id)
actor_get_angular_speed2
Description
Gets the squared angular speed of an actor.
Syntax
s = gh_bullet3.actor_get_angular_speed2(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
Code sample
s = gh_bullet3.actor_get_angular_speed2(actor_id)
actor_get_angular_velocity
Description
Gets the angular velocity of an actor.
Syntax
x, y, z = gh_bullet3.actor_get_angular_velocity(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
- x, y, z [REAL]: velocity vector
Code sample
x, y, z= gh_bullet3.actor_get_angular_velocity(actor_id)
actor_get_contact_info
Description
Gets information about contacts of an actor.
Syntax
num_contacts = gh_bullet3.actor_get_contact_info(
actor_id,
px, py, pz
)
Languages
Parameters
- actor_id [ID]: actor identifier
- px, py, pz [REAL]: position of the first contact
Return Values
- num_contacts [INTEGER]: number of contacts
Code sample
num_contacts, px, py, pz = gh_bullet3.actor_get_contact_info(actor_id)
actor_get_linear_speed2
Description
Gets the squared linear speed of an actor.
Syntax
s = gh_bullet3.actor_get_linear_speed2(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
Code sample
s = gh_bullet3.actor_get_linear_speed2(actor_id)
actor_get_linear_velocity
Description
Gets the linear velocity of an actor.
Syntax
x, y, z = gh_bullet3.actor_get_linear_velocity(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
- x, y, z [REAL]: velocity vector
Code sample
x, y, z= gh_bullet3.actor_get_linear_velocity(actor_id)
actor_get_orientation
Description
Gets the orientation of an actor.
Syntax
qx, qy, qz, qw = gh_bullet3.actor_get_orientation(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
- qx, qy, qz, qw [REAL]: orientation quaternion
Code sample
qx, qy, qz, qw = gh_bullet3.actor_get_orientation(actor_id)
actor_get_position
Description
Gets the position of an actor.
Syntax
x, y, z = gh_bullet3.actor_get_position(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
- x, y, z [REAL]: 3D position
Code sample
x, y, z = gh_bullet3.actor_get_position(actor_id)
actor_kill
Description
Destroys an actor.
Syntax
gh_bullet3.actor_kill(
actor_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_kill(actor_id)
actor_set_3d_object
Description
Allows to associate a physics actor and a 3D object. Useful for the scene_sync_3d_objects() function.
Syntax
gh_bullet3.actor_set_3d_object(
actor_id,
o3d_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
- o3d_id [ID]: 3d object identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_3d_object(actor_id, o3d_id)
actor_set_activation_state
Description
Sets the activation state of an actor.
Syntax
gh_bullet3.actor_set_activation_state(
actor_id,
state
)
Languages
Parameters
- actor_id [ID]: actor identifier
- state [INTEGER]: activation state (0 or 1)
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_activation_state(actor_id, state)
actor_set_angular_factor
Description
Allows to limit (or amplify) the angular velocity along some axis.
Syntax
gh_bullet3.actor_set_angular_factor(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: XX factor
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_angular_factor(actor_id, x, y, z)
actor_set_angular_velocity
Description
Sets the angular velocity of an actor.
Syntax
gh_bullet3.actor_set_angular_velocity(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: velocity vector
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_angular_velocity(actor_id, x, y, z)
actor_set_ccd_params
Description
Sets the CCD (continuous collision detection) parameters. Useful to improve simulation stability.
Syntax
gh_bullet3.actor_set_ccd_params(
actor_id,
motion_threshold,
swept_sphere_radius
)
Languages
Parameters
- actor_id [ID]: actor identifier
- motion_threshold [REAL]: CCD is not performed if the motion (in one step) is less then motion_threshold
- swept_sphere_radius [REAL]: swept sphere radius (0.0 by default)
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_ccd_params(actor_id, motion_threshold, swept_sphere_radius)
actor_set_collision_margin
Description
Sets the collision margin of an actor. Useful to improve simulation stability.
Syntax
gh_bullet3.actor_set_collision_margin(
actor_id,
margin
)
Languages
Parameters
- actor_id [ID]: actor identifier
- margin [REAL]: collision margin
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_collision_margin(actor_id, margin)
actor_set_damping
Description
Sets damping factors.
Syntax
gh_bullet3.actor_set_damping(
actor_id,
linear,
angular
)
Languages
Parameters
- actor_id [ID]: actor identifier
- linear [REAL]: linear damping
- angular [REAL]: angular damping
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_damping(actor_id, linear, angular)
actor_set_gravity
Description
Sets a gravity vector for an actor.
Syntax
gh_bullet3.actor_set_gravity(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: gravity vector
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_gravity(actor_id, x, y, z)
actor_set_linear_factor
Description
Allows to limit (or amplify) the linear velocity along some axis.
Syntax
gh_bullet3.actor_set_linear_factor(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: XX factor
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_linear_factor(actor_id, x, y, z)
actor_set_linear_velocity
Description
Sets the linear velocity of an actor.
Syntax
gh_bullet3.actor_set_linear_velocity(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: velocity vector
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_linear_velocity(actor_id, x, y, z)
actor_set_material
Description
Updates an actor's material.
Syntax
gh_bullet3.actor_set_material(
actor_id,
mat_id
)
Languages
Parameters
- actor_id [ID]: actor identifier
- mat_id [ID]: material identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_material(actor_id, mid)
actor_set_orientation
Description
Sets the orientation of an actor.
Syntax
gh_bullet3.actor_set_orientation(
actor_id,
qx, qy, qz, qw
)
Languages
Parameters
- actor_id [ID]: actor identifier
- qx, qy, qz, qw [REAL]: orientation quaternion
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_orientation(actor_id, qx, qy, qz, qw)
actor_set_position
Description
Sets the position of an actor.
Syntax
gh_bullet3.actor_set_position(
actor_id,
x, y, z
)
Languages
Parameters
- actor_id [ID]: actor identifier
- x, y, z [REAL]: 3d position
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_position(actor_id, x, y, z)
actor_set_sleeping_thresholds
Description
Sets the linear and angular sleeping thresholds.
Syntax
gh_bullet3.actor_set_sleeping_thresholds(
actor_id,
linear,
angular
)
Languages
Parameters
- actor_id [ID]: actor identifier
- linear [REAL]: linear sleeping threshold
- angular [REAL]: angular sleeping threshold
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_set_sleeping_thresholds(actor_id, linear, angular)
actor_update_mass
Description
Updates the mass of an actor.
Syntax
gh_bullet3.actor_update_mass(
actor_id,
mass
)
Languages
Parameters
- actor_id [ID]: actor identifier
- mass [REAL]: mass
Return Values
This function has no return value(s).
Code sample
gh_bullet3.actor_update_mass(actor_id, mass)
get_version
Description
Gets the Bullet API version as a single integer (ex: 288).
Syntax
version = gh_bullet3.get_version()
Languages
Parameters
This function has no input parameter(s).
Return Values
- version [INTEGER]: API version
Code sample
version = gh_bullet3.get_version()
init
Description
Initializes the Bullet3 plugin. This the first function to call.
Syntax
ret = gh_bullet3.init()
Languages
Parameters
This function has no input parameter(s).
Return Values
- ret [BOOLEAN]: return code: 1 (success) or 0 (error)
Code sample
ret = gh_bullet3.init()
material_create
Description
Creates a new material.
Syntax
mat_id = gh_bullet3.material_create(
restitution,
friction
)
Languages
Parameters
- restitution [REAL]: restitution factor
- friction [REAL]: friction factor
Return Values
- mat_id [ID]: material identifier
Code sample
mat_id = gh_bullet3.material_create(restitution, friction)
material_kill
Description
Destroys a material.
Syntax
gh_bullet3.material_kill(
mat_id
)
Languages
Parameters
- mat_id [ID]: material identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.material_kill(mat_id)
material_update
Description
Updates the properties of a material.
Syntax
gh_bullet3.material_update(
mat_id,
friction,
restitution
)
Languages
Parameters
- mat_id [ID]: material identifier
- friction [REAL]: friction
- restitution [REAL]: resilience / restitution
Return Values
This function has no return value(s).
Code sample
restitution = 0.9
friction = 0.5
gh_bullet3.material_update(mat_id, restitution, friction)
-- now update the material for a particular actor
gh_bullet3.actor_set_material(actor_id, mat_id)
scene_add_actor
Description
Adds a physics actor to a physics scene.
Syntax
gh_bullet3.scene_add_actor(
scene_id,
actor_id
)
Languages
Parameters
- scene_id [ID]: scene identifier
- actor_id [ID]: actor identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.scene_add_actor(scene_id, actor_id)
scene_check_contacts
Description
Checks all contacts in a scene.
Syntax
num_contacts = gh_bullet3.scene_check_contacts(
scene_id
)
Languages
Parameters
- scene_id [ID]: scene identifier
Return Values
- num_contacts [INTEGER]: number of contacts
Code sample
num_contacts = gh_bullet3.scene_check_contacts(scene_id)
scene_create
Description
Creates and initializes a physics scene (Bullet Dbvt broadphase).
Syntax
scene_id = gh_bullet3.scene_create()
Languages
Parameters
This function has no input parameter(s).
Return Values
- scene_id [ID]: scene identifier
Code sample
scene_id = gh_bullet3.scene_create()
scene_create_sap
Description
Creates and initializes a physics scene (Bullet AxisSweep3 broadphase). For this scene, you have to specify the expected scene dimensions.
Syntax
scene_id = gh_bullet3.scene_create_sap(
min_x, min_y, min_z,
max_x, max_y, max_z
)
Languages
Parameters
- min_x, min_y, min_z [REAL]: world dimensions (minimal AABB values)
- max_x, max_y, max_z [REAL]: world dimensions (maximal AABB values)
Return Values
- scene_id [ID]: scene identifier
Code sample
scene_id = gh_bullet3.scene_create_sap(x0, y0, z0, x1, x1, z1)
scene_kill
Description
Terminates and destroys a physics scene.
Syntax
gh_bullet3.scene_kill(
scene_id
)
Languages
Parameters
- scene_id [ID]: scene identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.scene_kill(scene_id)
scene_remove_actor
Description
Removes a physics actor from a physics scene.
Syntax
gh_bullet3.scene_remove_actor(
scene_id,
actor_id
)
Languages
Parameters
- scene_id [ID]: scene identifier
- actor_id [ID]: actor identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.scene_remove_actor(scene_id, actor_id)
scene_reset_all_contacts
Description
Resets all contacts in a scene. Should be called before scene_step_simulation().
Syntax
gh_bullet3.scene_reset_all_contacts(
scene_id
)
Languages
Parameters
- scene_id [ID]: scene identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.scene_reset_all_contacts(scene_id)
scene_set_gravity
Description
Sets the global gravity of the scene (ex: [0.0, -10.0, 0.0])
Syntax
gh_bullet3.scene_set_gravity(
scene_id,
x, y, z
)
Languages
Parameters
- scene_id [ID]: scene identifier
- x, y, z [REAL]: gravity vector
Return Values
This function has no return value(s).
Code sample
gh_bullet3.scene_set_gravity(scene_id, x, y, z)
scene_set_solver_num_iterations
Description
Sets the number of iterations of the solver. The simulation stability increases with the number of iterations but the simulation is slower.
Syntax
gh_bullet3.scene_set_solver_num_iterations(
scene_id,
num_iterations
)
Languages
Parameters
- scene_id [ID]: scene identifier
- num_iterations [INTEGER]: number of iterations - default value is 10.
Return Values
This function has no return value(s).
Code sample
gh_bullet3.scene_set_solver_num_iterations(scene_id, iterations)
scene_step_simulation
Description
Performs a scene simulation step. The relation between the parameters should follow this rule: timeStep < maxSubSteps * fixedTimeStep
Syntax
gh_bullet3.scene_step_simulation(
scene_id,
time_step,
max_sub_steps,
fixed_time_step
)
Languages
Parameters
- scene_id [ID]: scene identifier
- time_step [REAL]: time step between two frames
- max_sub_steps [INTEGER]: number of sub steps
- fixed_time_step [REAL]: fixed time step - default value: 1.0/60.0
Return Values
This function has no return value(s).
Code sample
gh_bullet3.scene_step_simulation(scene_id, dt, max_sub_steps, 1.0/60.0)
scene_sync_3d_objects
Description
Synchronizes physics and graphics objects. A physcis actor is associated to a 3D object using the actor_set_3d_object() function.
Syntax
gh_bullet3.scene_sync_3d_objects(
scene_id
)
Languages
Parameters
- scene_id [ID]: scene identifier
Return Values
This function has no return value(s).
Code sample
gh_bullet3.scene_sync_3d_objects(scene_id)
terminate
Description
Stops the Bullet engine and frees resources.
Syntax
ret = gh_bullet3.terminate()
Languages
Parameters
This function has no input parameter(s).
Return Values
- ret [BOOLEAN]: return code: 1 (success) or 0 (error)
Code sample
ret = gh_bullet3.terminate()
| |