Setting external direction and torque (steer force)

:mrgreen:



I'm implementing opensteer for JMonkeyengine and so far I'm doing good. (I'll even release it for all your enjoyment once I have tested it thoroughly).



Now, I want to combine open steer and JMEPhysics. The problem, however, is that in open steer the steering force is always the direction where the force is applied. Thus if you want the object to face the propulsed direction you have to regenerate the local space each update based on the steering force.



My question is this: does anyone have any ideas how to make this work with torque so that it won't bother the physics simulation.



Now there are two ways to solve this issue:

  1.) turn steering force into torque and propulsion force and apply those. (How to turn force into torque around axis?)

  2.) apply the orientation to the body and somehow apply the other forces and torgues to this new how orientation. Doesn't sound right and definitely will causes jitter.




Hmm, would this be possible using a rotational joint as steer axis like here:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=4889.0


What about using spheres and only rotate the visual part to face the moving direction?

This works a little bit like it, but it is not as good as I wanted.



I'm currently doing all the steering in afterStep, but it still is kind of slow and jittery, for some reason. Furthermore external forces kind of mess up the smoothedAcceleration variable, which makes everything kind of strange looking. I'll investigate a bit more, but I guess I just need to figure out a way to do the steering in the physics way.

captain_g said:

This works a little bit like it, but it is not as good as I wanted.

I'm currently doing all the steering in afterStep, but it still is kind of slow and jittery, for some reason. Furthermore external forces kind of mess up the smoothedAcceleration variable, which makes everything kind of strange looking. I'll investigate a bit more, but I guess I just need to figure out a way to do the steering in the physics way.


Hmm,

I got part of the jittering away by splitting opensteering into beforeStep and afterStep functions.

Does anyone have any idea if it is possible to apply rotations in afterStep to local rotation? I tried this, but it didn't work out too well. The objects still bounce very heavily on collision.

I guess the best option is to give spherical bounding volumes to objects and then set the direction of the rendered object manually. This isn't exactly as good or accurate as I wanted but its one way to get physics. If it comes to this I won't be using ODE though.

If you want to control rotation by torque you will need to handle that in your AI to do it properly. As opensteer does not do that, you're best off with faking the direction, imo.