www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: penprakash on July 30, 2013, 01:01:34 pm

Title: Object rotation
Post by: penprakash 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?

Title: Re: Object rotation
Post by: EgonOlsen 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);