Applyimpulse movement wrong

@diepen45 said: I found something else that was funny when i used the quaternion.getRotationColumn(2) method, if i applied negative thrust to both engines the complete ship whould flip over and move. with positive thrust it flipped back again. quaternion.mult(Vector3F.UNIT_Z) didn't behave in the same way but behaved like it should.

This really starts to sound like you are doing something strange somewhere. You might try putting together a simple test case that illustrates your problem so that it will be easier to rule out other strangeness.

@pspeed
If there is a way to send you my complete code without poluting this forum too much i would do it.
But i have to do that tomorrow when i wake up, i have to leave in 30 minutes (and i’m still not properly dressed for a party…)

@diepen45 said: @pspeed If there is a way to send you my complete code without poluting this forum too much i would do it. But i have to do that tomorrow when i wake up, i have to leave in 30 minutes (and i'm still not properly dressed for a party..)

The point of creating a separate test case is to narrow the problem down to the minimum. Often YOU will find the problem yourself during that process.

Anyway, have you tried just applying UNIT_Z as the direction vector (without any rotation). If position is object-relative then perhaps direction is also.

1 Like

@pspeed

I’ve solved the direction error.
[java] @Override
protected void controlUpdate(float tpf) {
control.applyImpulse(new Vector3f(0f, calculateHover(tpf), 0f),
new Vector3f(0, 0, 0));

	Vector3f impulsedir = control.getPhysicsRotation()
			.mult(Vector3f.UNIT_Z);

	control.applyImpulse(impulsedir.mult((rthrust * 10000) * tpf),
			phoenix.engine1.getWorldTranslation());

	control.applyImpulse(impulsedir.mult((lthrust * 10000) * tpf),
			phoenix.engine2.getWorldTranslation());

	if (level) {
		control.setAngularVelocity(Vector3f.ZERO);
	}

}[/java] 

This did the trick, (after I attached the engine1 and 2 node to the main node (stupid me!))

Now another issue came up, i have told it before, but when i apply forward thrust the ship nosedives until it is upside down and than it wil speed away in the direction the nose is facing. when i apply backward thrust it will flip back again and go backward in the direction it is facing.

EDIT:
i’ve watched this behaviour for a few minutes and noticed that when it flies upside down and it is as far from the center as it was when it flipped, but than on the other side, it will flip back again, and then the cycle continues.

Some time ago i tried to create a ship with this kind of propulsion. Right now your problem is that you don’t apply a central force, so the ship turn. Imagine a bottle : if you push it at the top, the bottle will fall, you need to push it at it’s central point to make it move. It’s something very hard to do to move a ship with thrusts, as it will not stay horizontal.

And as soon as your vehicle will hit something, you’ll totally loose the control on it, as it will be close to impossible to stabilize it. And this kind of comportement could (will ?) piss off the player.

I don’t know any “good” solution to this (this fact ended my old project, as i wanted to have realistic physic in a game but i didn’t realize that realistic physic => unplayable game. You can even have a look at games like the QWOP game with the athlete)

1 Like

@bubuche
That explains it. Well i still have to install my control surfaces(ailerons, rudders etc) and the other engines + somekind of flight computer/dynamics.

luckyly the game i’m building is more a pet research project for myself, for now i’m not really planning on releasing it or so (at least not at the moment)
I’m writing a book, and the ship plays a vital part in it, I am modeling the ship in google sketchup, so i can have a reference of the ship to keep the story consistent.
(It would be kind off sloppy if i come from somewhere and a room is first on the righthand side and a next time on the left.) And i thought it would be kind of cool to be able to walk in it, and fly with it.

@all
Thanks for your help, for now you have helped me a lot.

P.S. how do i mark this topic as solved?

1 Like