Kinematic Objects in Bullet Physics


GeeXLab demo - Bullet3 Physics



Downloads

GeeXLab 0.32.0 fixed a small but annoying bug in the Bullet3 physics plugin: setting the position or orientation of kinematic objects (or actors in the terminology of NVIDIA PhysX) didn’t work. It’s now fixed.

You can create a kinematic actor in Bullet3 by setting the mass to 0. A kinematic actor is an actor that can interact with other actors (dynamic bodies) but is not impacted by gravity or collision with other actors.

Let’s see an example. Here is how to create a kinematic box actor:

mass = 0.0 
box_size = 1.0
pos_x = 2.0
pos_y = 1.0
pos_z = 0.0
b3_box2 = gh_bullet3.actor_create_box(box_size, box_size, box_size,   pos_x, pos_y, pos_z,  mass, material)
gh_bullet3.scene_add_actor(b3_scene, b3_box2)

You can now move and rotate this kinematic box with the following functions:

gh_bullet3.actor_set_position(b3_box2, kinematic_pos.x, kinematic_pos.y, kinematic_pos.z)
 
qx, qy, qz, qw = gh_utils.math_quat_from_euler_angles(0, 0, 0)
gh_bullet3.actor_set_orientation(b3_box2, qx, qy, qz, qw)

Demos are available in the OpenGL 2.1 demopack: geexlab-demopack-gl-21/d26-bullet3-physics/03/ and geexlab-demopack-gl-21/d26-bullet3-physics/04/.

Demos 03 and 04: I added a very simple way to control the position of the kinematic box: two sliders, one for X axis and the second for Z axis. In the demo 04, two kinematic objects are obstacles.





Leave a Comment

Your email address will not be published. Required fields are marked *