Open lucasw opened 5 years ago
C) Kinematic objects, which are objects without mass, but the user can move them. There is on-way interaction, and Bullet calculates a velocity based on the timestep and previous and current world transform. Bullet automatically deactivates dynamic rigid bodies, when the velocity is below a threshold for a given time. Deactivated (sleeping) rigid bodies don't take any processing time, except a minor broadphase collision detection impact (to allow active objects to activate/wake up sleeping objects)
https://pybullet.org/Bullet/BulletFull/classbtRigidBody.html
This seems to be saying that setLinearVelocity won't work (but maybe it used to, searches are conflicting), and the position should be updated instead?
Others suggest a sub-classed motion state is required.
Simply setting a new transform every update seems too slow- that would happen at the slower external update rate, rather than the internal high speed physics update- so would an object be making abrupt jerks instead of moving smoothly, and interactions with contacting objects will be fouled up?
It looks like the best method is to use the dynamics world setInternalTickCallback and have the callback loop through all the rigid bodies and update the world transforms of those that are kinematic. The dynamics will properly derive the velocity from these fine step position updates, getLinearVel will return the time as desired.
bulletphysics/bullet3#1204
Next support angular velocities.
Need to initialize the kinematic linear vel to 0 0 0
Need a service to set the position of a kinematic object (works equally well for dynamic objects also?)- setWorldTransform on them.
mass is zero, but need to
setCollisonFlags
CF_KINEMATIC_OBJECT
andsetActivationState(DISABLE_DEACTIVATE)