Author Topic: Object rotation  (Read 1604 times)

Offline penprakash

  • byte
  • *
  • Posts: 26
    • View Profile
Object rotation
« on: July 30, 2013, 01:01:34 pm »
Hi,

 i have added the code to display object in jpct-ae

 model.align(camera)

 when i move the direction the whole object is moving / rotated. How to place the object in static position with camera?


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Object rotation
« Reply #1 on: July 30, 2013, 09:01:13 pm »
align() only affects rotations, not translations. If you want the object to stay in front of the camera, try something like this (untested, might contain errors):

Code: [Select]
SimpleVector pos=camera.getPosition();
SimpleVector x=camera.getZAxis();
x.scalarMul(50);
pos.add(x);
obj.clearTranslation();
obj.translate(pos);
obj.align(camera);