Hi everybody !
As you can see, I’m new here…! That’s probably why the following question may be stupid (sorry in advance…)
I’m actually working on a project (for studies purpose) with jMonkeyEngine (of curse) and I have some troubles about physics stuff: I’d like to make an airplane fly properly with JBullet, but I cant’t find any complete tutorial about this topic. Obviously, I made some ressearches but none was good enought to allow me to progress on my work.
Here is what I’m actually having (thanks to this topic for giving me a clue:
http://hub.jmonkeyengine.org/forum/topic/simulating-lift-for-an-aircraft/)
[java]
plane = (Node) assetManager.loadModel(“Cube.mesh.xml”);
plane.scale(3, 3, 10);
CompoundCollisionShape planeShape = (CompoundCollisionShape)
CollisionShapeFactory.createDynamicMeshShape((Node) plane);
planeControl = new VehicleControl(planeShape, 400);
plane.addControl(planeControl);
bulletAppState.getPhysicsSpace().add(planeControl);
[/java]
And for the inputs:
[java]
if (name.equals(“Left”)) {
Vector3f direction=new Vector3f(0f,10f,-0.5f);
planeControl.getPhysicsRotation().multLocal(direction);
planeControl.applyTorqueImpulse(direction);
}
if (name.equals(“Right”)) {
Vector3f direction=new Vector3f(0f,-10f,0.5f);
planeControl.getPhysicsRotation().multLocal(direction);
planeControl.applyTorqueImpulse(direction);
}
if (name.equals(“Forward”)) {
Vector3f direction=new Vector3f(0f,20f,50f);
Vector3f direction2=new Vector3f(-25f,0f,0f);
planeControl.getPhysicsRotation().multLocal(direction);
planeControl.getPhysicsRotation().multLocal(direction2);
planeControl.applyImpulse(direction, Vector3f.ZERO);
planeControl.applyTorqueImpulse(direction2);
}
[/java]
Also, I found a great video that explains basicly how planes fly: [video]The Forces on an Airplane - YouTube
That’s it for the moment, don’t hestitate to ask for details, or letting me know if I’m not clear enought (I don’t speak a fluent English, sorry for any mistake…)