Joint Constraint Drift
Posted: Sat Oct 12, 2013 4:46 pm
Well, Thanks this to this post viewtopic.php?f=4&t=2065, I've got some turrets working well on my tanks.
I have another problem now though. This video shows the issue http://www.youtube.com/watch?v=WPYiqpxj7C0. To describe it, you'll see the turrets tracking the camera (viewer). All seems fine. I flick to controlling the large cylinder and apply some impulse to the entity - The turrets are attached to it (via RevoluteJoint's). When I flick back to the flying camera, you'll see over time that the joint constraints drift from their original instantiated position relative to the large cylinder. I'm using the debug drawerer. See the red lines from the constraint position extending and the turret orientation loosing the plot. I can't figure out why this is happening. The Tanks don't appear to exhibit this although they are a lot smaller.
Regarding the cylinder entity, the Orientation is currently forced to be upright with a yaw setting each frame (via setting the OrientationMatrix). ApplyImpulse is based on that OrientationMatrix...
BEPUEntity.ApplyImpulse(Vector3.Zero, BEPUEntity.OrientationMatrix.Forward * -5000f * ControlSchema.LeftStick.Y);
Appreciate any advice!?
...I did have SingleEntityAngularMotor keeping the thing up right (1 for each axis ... Up, Right, Forward for yaw, pitch and roll), but that's another post/problem to come.
I have another problem now though. This video shows the issue http://www.youtube.com/watch?v=WPYiqpxj7C0. To describe it, you'll see the turrets tracking the camera (viewer). All seems fine. I flick to controlling the large cylinder and apply some impulse to the entity - The turrets are attached to it (via RevoluteJoint's). When I flick back to the flying camera, you'll see over time that the joint constraints drift from their original instantiated position relative to the large cylinder. I'm using the debug drawerer. See the red lines from the constraint position extending and the turret orientation loosing the plot. I can't figure out why this is happening. The Tanks don't appear to exhibit this although they are a lot smaller.
Regarding the cylinder entity, the Orientation is currently forced to be upright with a yaw setting each frame (via setting the OrientationMatrix). ApplyImpulse is based on that OrientationMatrix...
BEPUEntity.ApplyImpulse(Vector3.Zero, BEPUEntity.OrientationMatrix.Forward * -5000f * ControlSchema.LeftStick.Y);
Appreciate any advice!?
...I did have SingleEntityAngularMotor keeping the thing up right (1 for each axis ... Up, Right, Forward for yaw, pitch and roll), but that's another post/problem to come.