jPCT-AE - a 3d engine for Android > Support

Object rotation

(1/1)

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


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

--- End code ---

Navigation

[0] Message Index

Go to full version