Object Rotation

Started by bgilb3, March 13, 2005, 11:26:05 AM

Previous topic - Next topic

bgilb3

shape.translate(0f,0f,forwardSpeed);
shape.rotateY(turnSpeed);


i was wondering how i can make the rotatation permanent? Like how the cameras MoveIN thing works. Because no matter what the rotation is, the shape always just goes outward from the camera ( im trying to make it so when you rotate the object, its direction changes ) ie when you hit forward it goes another direction )

EgonOlsen

If i understand you correctly, try something like

shape.translate(shape.getZAxis());

Anonymous

Yeah I tried that, kinda works except ..

It doesn't allow me to define a speed :-(

EgonOlsen

Try something like this:

SimpleVector s=shape.getZAxis();
s.scalarMul(speed);
shape.translate(s);

Anonymous

Gotcha, thanks that worked :D

bgilb3

How can i get the camera to follow something around like 3rd person?

EgonOlsen

Depends on your actual needs. One way of doing it be found in sources of the  car example.

bgilb3

so complicated :oops:

EgonOlsen

Quote from: "bgilb3"so complicated :oops:
Not really. It's in the CarTest.java in moveCamera. It's not that complicated...

brad3

Okay i got the camera to follow the object around, now im not sure how to get the camera to have the same rotation is the object

EgonOlsen

Depends on what you mean exactly. You may try to align them using Camera.align(<Object3D>) or use Camera.lookAt(<SimpleVector>) with the transformed center of the Object3D as point to look at.