Model getting rotated while translating

Started by JKumar, October 04, 2010, 08:35:02 AM

Previous topic - Next topic

JKumar

Hi,

        My models are getting rotated when i am trying to translate it.

I am attaching my file......Plz help it out.

[attachment deleted by admin]

JKumar


EgonOlsen

I don't see how this is supposed to happen and i can't run this code ATM. But, apart from that, what you shouldn't do is to do a translate in the onKeyDown, because it runs in another thread than the rendering. You'll get all kinds of funny side effects when doing so. Increasing the x/y-positions is fine, but move the actual translation into the moveCharacter method. Maybe this will already fix your problem!?

JKumar

Hi,

       Thanx for the reply.

      I don't know how the translate method is functioning but as per my new code the translate method is adding the coordinate value(x,y,z) to the last position of the model/object.

     Its working fine now but i supposed it to perform the translate by positioning the model to the supplied coordinate value.

I don't know if its because of onKeyDown as translated the model directly in the draw method.

But its a great pleasure to use jPCT for my project.

EgonOlsen

[quote author=JKumar link=topic=1723.msg12820#msg12820 date=1286359439
     Its working fine now but i supposed it to perform the translate by positioning the model to the supplied coordinate value.
[/quote]If you want to do absolute translations, just do:


obj.clearTranslation();
obj.translate(<your position>);


However, i don't understand how this is related to rotations...is your problem now fixed or not? I couldn't derive this from your answer...!?

JKumar