Mooving with "space rocket"

Hi,

i have problems with mooving with space rocket in Physics… I want to press for example "W" and rocket should slowly start to getting speed (depandace on its weight) and when I release "W" rocket shoul continous… but rocket should "fly" in its direction, no only "up" (0, 1, 0). Can someone help me?

Simply apply a force to the rocket in the direction of the rocket for some frames. Have a look at Lesson5 on how to apply forces continuously.

Coon, but how can I do some moovment straight? because when the rocket is mooving and rotating, i want force, wich depending on rocket rotation, so rocket should fly with "head" first If you understand me…

Cows are bottom heavy though, so you might run into some issues trying to make it go "head-first" if you are pushing from the "rear". 

i dont know if you understand me, but i only want to make "real-reaging" rocket model, so my force from its "engine" should push rocket in its direction a nd if I rotate the rocket, the vector of force will be other than first… so I cant use vector {0, 1, 0} for mooving up, because if the rocket is upside-down, it should fly down

i think what you want is to apply the force into the direction the rocket is currently heading right?


Vector3f direction = rocket.getLocalRotation().getRotationColumn(2, direction);
rocket.addForce(direction.mult(force));



try it with this

Yeah, this is exactly what I want, THX very much, but code i needed was:

…getRotationColumn(1, direction);

:slight_smile:



and I have two morequestions:

  1. How can I turn on on engine animation, when key is pressed and turn off when key released? I am using this code, for movement:



    physicsStepInputHandler.addAction(new MyInputAction(1), InputHandler.DEVICE_KEYBOARD, KeyInput.KEY_U, InputHandler.AXIS_NONE, true);







    private class MyInputAction extends InputAction{

          private int type;

2)

guess you use addTorque to do the rotation by force.

Yeah! addTorque() is exactly what i need to rotation :slight_smile: thx

And Last question:

3) how to make my rocket fly only in X and Y axis… like 2D game with 3D objects? because my forcces are only in X and Y axis, but when rocket hit wall, it knocks off in little Z axis and fall out of 2D. So how to disable movment in Z axis?

I guess a TranslationalJoint. Maybe it's a good idea to read the physics wiki?

Translational joints probably cause you more headaches than they're worth for this purpose. Simply setting the rockets back to their plane before drawing them should be enough.

irrisor said:

Translational joints probably cause you more headaches than they're worth for this purpose. Simply setting the rockets back to their plane before drawing them should be enough.


nice!
i made this this way:

protected void simpleUpdate(){

NightElf said:

i cant understand Torque

use a dictionary and/or lexicon in this case
irrisor said:

use a dictionary and/or lexicon in this case

yes I know, but it is easy to translate form english to my language, but when i am searching sometnig, I transalate to other word and searching is much hard, for example I never heard word "Torque" (in english) to now :D

sure, that's a common problem - finding the right keywords for searching…



but your question 2) is solved then, right?

irrisor said:

but your question 2) is solved then, right?

Os sry, question 1) of course

not physics related, but: stop the particle manager from emitting particles, e.g. by setting emission rate to 0. Or you can cull it. Or you can detach it from the scenegraph (as it will not be back on, probably)…

yes, but on wich events should I implement it? some key up and key down event

:? that really depends on your game logic, you need to decide that yourself

Ok, so thanks for everything…