Author Topic: Object Rotation  (Read 6542 times)

bgilb3

  • Guest
Object Rotation
« on: March 13, 2005, 11:26:05 am »
Code: [Select]
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 )

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object Rotation
« Reply #1 on: March 13, 2005, 05:29:00 pm »
If i understand you correctly, try something like

Code: [Select]
shape.translate(shape.getZAxis());

Anonymous

  • Guest
Object Rotation
« Reply #2 on: March 13, 2005, 06:43:34 pm »
Yeah I tried that, kinda works except ..

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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object Rotation
« Reply #3 on: March 13, 2005, 06:47:10 pm »
Try something like this:

Code: [Select]
SimpleVector s=shape.getZAxis();
s.scalarMul(speed);
shape.translate(s);

Anonymous

  • Guest
Object Rotation
« Reply #4 on: March 13, 2005, 06:57:59 pm »
Gotcha, thanks that worked :D

bgilb3

  • Guest
Object Rotation
« Reply #5 on: March 13, 2005, 08:17:57 pm »
How can i get the camera to follow something around like 3rd person?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object Rotation
« Reply #6 on: March 14, 2005, 05:06:55 pm »
Depends on your actual needs. One way of doing it be found in sources of the  car example.

bgilb3

  • Guest
Object Rotation
« Reply #7 on: March 14, 2005, 11:13:03 pm »
so complicated :oops:

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object Rotation
« Reply #8 on: March 15, 2005, 12:40:30 am »
Quote from: "bgilb3"
so complicated :oops:
Not really. It's in the CarTest.java in moveCamera. It's not that complicated...

brad3

  • Guest
Object Rotation
« Reply #9 on: March 16, 2005, 12:08:52 am »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Object Rotation
« Reply #10 on: March 16, 2005, 07:43:34 am »
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.