< 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: 57

  1. gh_bullet3.actor_apply_central_force ()
  2. gh_bullet3.actor_apply_central_impulse ()
  3. gh_bullet3.actor_apply_torque ()
  4. gh_bullet3.actor_apply_transform ()
  5. gh_bullet3.actor_get_transform_mat16 ()
  6. gh_bullet3.actor_get_transform_pos_qrot ()
  7. gh_bullet3.actor_clear_forces ()
  8. gh_bullet3.actor_create_box ()
  9. gh_bullet3.actor_create_box_v2 ()
  10. gh_bullet3.actor_create_cylinder ()
  11. gh_bullet3.actor_create_cylinder_v2 ()
  12. gh_bullet3.actor_create_mesh ()
  13. gh_bullet3.actor_create_mesh_v2 ()
  14. gh_bullet3.actor_create_sphere ()
  15. gh_bullet3.actor_create_sphere_v2 ()
  16. gh_bullet3.actor_create_static_plane ()
  17. gh_bullet3.actor_get_activation_state ()
  18. gh_bullet3.actor_get_angular_speed2 ()
  19. gh_bullet3.actor_get_angular_velocity ()
  20. gh_bullet3.actor_get_contact_info ()
  21. gh_bullet3.actor_get_linear_speed2 ()
  22. gh_bullet3.actor_get_linear_velocity ()
  23. gh_bullet3.actor_get_orientation ()
  24. gh_bullet3.actor_get_position ()
  25. gh_bullet3.actor_kill ()
  26. gh_bullet3.actor_set_3d_object ()
  27. gh_bullet3.actor_set_activation_state ()
  28. gh_bullet3.actor_set_angular_factor ()
  29. gh_bullet3.actor_set_angular_velocity ()
  30. gh_bullet3.actor_set_ccd_params ()
  31. gh_bullet3.actor_set_collision_margin ()
  32. gh_bullet3.actor_set_damping ()
  33. gh_bullet3.actor_set_gravity ()
  34. gh_bullet3.actor_set_linear_factor ()
  35. gh_bullet3.actor_set_linear_velocity ()
  36. gh_bullet3.actor_set_material ()
  37. gh_bullet3.actor_set_orientation ()
  38. gh_bullet3.actor_set_position ()
  39. gh_bullet3.actor_set_sleeping_thresholds ()
  40. gh_bullet3.actor_update_mass ()
  41. gh_bullet3.get_version ()
  42. gh_bullet3.init ()
  43. gh_bullet3.material_create ()
  44. gh_bullet3.material_kill ()
  45. gh_bullet3.material_update ()
  46. gh_bullet3.scene_add_actor ()
  47. gh_bullet3.scene_check_contacts ()
  48. gh_bullet3.scene_create ()
  49. gh_bullet3.scene_create_sap ()
  50. gh_bullet3.scene_kill ()
  51. gh_bullet3.scene_remove_actor ()
  52. gh_bullet3.scene_reset_all_contacts ()
  53. gh_bullet3.scene_set_gravity ()
  54. gh_bullet3.scene_set_solver_num_iterations ()
  55. gh_bullet3.scene_step_simulation ()
  56. gh_bullet3.scene_sync_3d_objects ()
  57. 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


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


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


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


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


Return Values


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


Return Values


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


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


Return Values


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


Return Values


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


Return Values


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


Return Values


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


Return Values


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


Return Values


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


Return Values


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


Return Values


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


Return Values


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_get_activation_state

Description

Gets the activation state of an actor.


Syntax

state = gh_bullet3.actor_get_activation_state(
 actor_id
)

Languages


Parameters


Return Values


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


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


Return Values


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


Return Values


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


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


Return Values


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


Return Values


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


Return Values


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


Code sample


ret = gh_bullet3.init()
			


material_create

Description

Creates a new material.


Syntax

mat_id = gh_bullet3.material_create(
 restitution,
 friction
)

Languages


Parameters


Return Values


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


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


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


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


Return Values


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


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


Return Values


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


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


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


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


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


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


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


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


Code sample


ret = gh_bullet3.terminate()
			






GeeXLab Rootard Guide | Downloads | Contact | Newsletter