Object rotation

Started by penprakash, July 30, 2013, 01:01:34 PM

Previous topic - Next topic

penprakash

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?


EgonOlsen

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):


SimpleVector pos=camera.getPosition();
SimpleVector x=camera.getZAxis();
x.scalarMul(50);
pos.add(x);
obj.clearTranslation();
obj.translate(pos);
obj.align(camera);