arne I have one question about your code example. rotation.mul(velocity) does not seem to work mul does not accept a Vector3f, it looks like it only takes another Matrix3f, do you think you could help me fix this please?
but in a car I would expect the world coordinate speed vektor to be aligned with my car's orientation (momentarily), if not, then I'm sliding a lot and my forward speed would be the least of my worries.
Yeah that sliding is exactly what I am trying to counter act. I dont think setting a velocity will work to well as it will counter collisions so I will go straight through things I shouldn't. I am applying a force to my body not a velocity.
Currently I do this:
1 2 3
| Vector3f relForce = getRelForce(speedForce); Vector3f FinalForce = FinalForce.sub(relForce, myBody.getLinearVel()); myBody.addForce(finalForce); |
This works fairly well as long as the body is moving forwards however if my body hits and object and bounces backwards my linera velocity is negative and FinalForce.sub(relForce, myBody.getLinearVel()); add the 2 forces together which creates a situation where I now have more force than I'm supposed to. I think I can fix this using the example arne provided.
But otelo I have seen other examples around of what you describe and it sounds interesting. My question is from your code what is carForward and what does carTransfrom do and do your think it would apply the same way to force not velocity?