Troubles with setAngularVelocity on rigid body
Posted: Sat Dec 22, 2018 12:57 pm
Hi,
I'm trying to implement a character controller with rigid bodies. I'm not using bullet's kinematic character controller since it does not interact properly with other rigid bodies (or I'm missing something..).
I currently have a rigid body with a capsule shape, and I set angular factor to 0 to lock rotation (maybe this is not a good idea ?). I then drive the rigid body angular velocity by using setAngularVelocity before running world->stepSimulation(...); The angular velocity is set turn the character to reach a target angle, and depends from the time step.
This almost works, but I have instability troubles because the velocity I set is took into account by bullet one frame later, and not during the first call to stepSimulation, so when the character reaches the target angle, it will continue to turn for one frame and will exceed target angle.
I also tried to implement this using btActionInterface, but it is even worse (effect of setAngularVelocity is visible 4 frames laters).
I also tried to directly set the transformation of the rigid body, but it seems to be hacky and it fucks up the character rigid body speed.
Is there any explanation why setting velocity has delayed effect ? Is there any better way to implement characters ?
Also, I really need to set character angle, even if shape is a capsule. This is because I use constraints when my character picks up objects.
Thanks in advance for any help
I'm trying to implement a character controller with rigid bodies. I'm not using bullet's kinematic character controller since it does not interact properly with other rigid bodies (or I'm missing something..).
I currently have a rigid body with a capsule shape, and I set angular factor to 0 to lock rotation (maybe this is not a good idea ?). I then drive the rigid body angular velocity by using setAngularVelocity before running world->stepSimulation(...); The angular velocity is set turn the character to reach a target angle, and depends from the time step.
This almost works, but I have instability troubles because the velocity I set is took into account by bullet one frame later, and not during the first call to stepSimulation, so when the character reaches the target angle, it will continue to turn for one frame and will exceed target angle.
I also tried to implement this using btActionInterface, but it is even worse (effect of setAngularVelocity is visible 4 frames laters).
I also tried to directly set the transformation of the rigid body, but it seems to be hacky and it fucks up the character rigid body speed.
Is there any explanation why setting velocity has delayed effect ? Is there any better way to implement characters ?
Also, I really need to set character angle, even if shape is a capsule. This is because I use constraints when my character picks up objects.
Thanks in advance for any help