[SOLVED] Interpolation and Vehicle Issues
Posted: Thu Jul 14, 2016 6:27 pm
I didn't want to pollute my first thread with several topics, so I started a new one. Now, where I got the "Interpolation Mode" running and tried to add a vehicle instance, I noticed some related issues:
1. Calling Space.Update() instead of Space.Update(dt) while BufferedStates.Enabled and InterpolatedStates.Enabled are both true makes the wheels not follow the car due to the fact that the line:
in the public method UpdateWorldTransform() of the CylinderCastWheelShape class will nevertheless use the interpolated vehicle position which is invalid since updates to InterpolatedStates only happen when calling the Space.Update(dt) method.
This issue almost made my head explode. Is there a reason for allowing Space.Update() calls although BufferedStates.Enabled and InterpolatedStates.Enabled are both true? Can I consider this a bug?
2. Even calling Space.Update(dt) (while BufferedStates.Enabled and InterpolatedStates.Enabled are both true) results in some weird behaviour as you can see in the following animation:
The vehicle body looks as if it snaps to some invisible grid. I am updating the visual representation for the vehicle in Unity's LateUpdate() method which means that it definitely happens after BEPU Physics' update calls are all done. The code looks like this:
Setting BufferedStates.Enabled and InterpolatedStates.Enabled both to false resolves this problem as you can see here:
So I thought it might be related to interpolation as well. What do you think?
1. Calling Space.Update() instead of Space.Update(dt) while BufferedStates.Enabled and InterpolatedStates.Enabled are both true makes the wheels not follow the car due to the fact that the line:
Code: Select all
worldAttachmentPoint += wheel.vehicle.Body.BufferedStates.InterpolatedStates.Position;
This issue almost made my head explode. Is there a reason for allowing Space.Update() calls although BufferedStates.Enabled and InterpolatedStates.Enabled are both true? Can I consider this a bug?
2. Even calling Space.Update(dt) (while BufferedStates.Enabled and InterpolatedStates.Enabled are both true) results in some weird behaviour as you can see in the following animation:
The vehicle body looks as if it snaps to some invisible grid. I am updating the visual representation for the vehicle in Unity's LateUpdate() method which means that it definitely happens after BEPU Physics' update calls are all done. The code looks like this:
Code: Select all
transform.position = vehicle.Body.Position.ToUnity();
So I thought it might be related to interpolation as well. What do you think?