Throttlecontroller is not Framerate independant

ThrottleController should be Framerate independant no?



If you play around with TestSwingControllEditor you will see that the Box moves very fast with a high Framerate, and very slow with a low framerate.



You can simlate different Framerates with:

 game.getSettings().setFramerate(10);



I think

spatial.getLocalTranslation().addLocal(spatial.getLocalRotation().getRotationColumn(0).mult(currentThrottle * time));

instead of

spatial.getLocalTranslation().addLocal(spatial.getLocalRotation().getRotationColumn(0).mult(currentThrottle));


does the trick.

edit: fixed it locally and, now it does work as expected :)
the multipliers have to cranked up quite a bit, to get the same speed as before tho.


Okay, that’s fixed in my local copy, but you might want to check out a much newer revision of the same concept here:



http://captiveimagination.com/svn/public/cigame/trunk/src/com/captiveimagination/game/control/ThrottleController.java



Actually, what I’m now using in Galaxies Beyond goes a few steps further even:



http://captiveimagination.com/svn/public/cigame/trunk/src/com/captiveimagination/game/control/physics/PhysicsThrustController.java



Those two are very specifically geared towards different environments but a decision does need to be made whether to integrate the ThrottleController back into jME or rip it out and only keep it in cigame.

Core-Dump said:

I think

spatial.getLocalTranslation().addLocal(spatial.getLocalRotation().getRotationColumn(0).mult(currentThrottle * time));

instead of

spatial.getLocalTranslation().addLocal(spatial.getLocalRotation().getRotationColumn(0).mult(currentThrottle));


does the trick.


Bump, this is not in cvs yet.

That's correct. ;)  Use the version in cigame instead…the one that's currently in jME should probably be removed…it's very explicit and not probably well suited being in jME.

hehe every once in a while i resurrect this thread sorry :slight_smile:

But i finally got around to change my ThrottleController to darkfrogs PhysicsThrustController and it works nicely.


  1. I think this should go into jmephysics cvs.

    Either as a utility class in the test-interactive folder or into com.jmex.physics.

    I could also write a small TestPhysicsTrustController if needed.

    What do you think?


darkfrog said:

...the one that's currently in jME should probably be removed...it's very explicit and not probably well suited being in jME.

I think the ThrottleController which is in package com.jme.input.controls.controller does not need to be removed, it works nicely also.
But in jmetest.input.controls.TestControls the values need to be altered, to reflect the recent changes.


Index: TestControls.java
===================================================================
RCS file: /cvs/jme/src/jmetest/input/controls/TestControls.java,v
retrieving revision 1.2
diff -r1.2 TestControls.java
91c91
<        ThrottleController throttle = new ThrottleController(box, forward, 1.0f, backward, -1.0f, 0.05f, 0.5f, 1.0f, false, Axis.Z);
---
>        ThrottleController throttle = new ThrottleController(box, forward, 200.0f, backward, -100.0f, 0.05f, 50f, 1.0f, true, Axis.Z);
93c93
<        RotationController rotation = new RotationController(box, rotateLeft, rotateRight, 0.2f, Axis.Y);
---
>        RotationController rotation = new RotationController(box, rotateLeft, rotateRight, 1f, Axis.Y);