Game Development Community

Drag Nose of Vehicle

by Robert Stewart · in Torque Game Engine · 10/31/2004 (7:36 pm) · 5 replies

Does anyone have a theory or a sample on how you might drag the nose of the vehicle and it would face or aim in that direction? thanks.

#1
10/31/2004 (8:51 pm)
Store old position, find delta to new position, normalize, convert to rotation. Apply rotation to object to update.
#2
11/01/2004 (7:59 am)
Ok thanks, can someone explain how i would do all that, lol sorry.
#3
11/01/2004 (10:33 am)
%oldpos = %vehicle.getTransform();
%delta = vectorSub(%oldpos,%newpos);
%normdelta = vectorNormalize(%delta);
%degX = mRadtoDeg(getWord(%normdelta,1));
%degY = mRadtoDeg(getWord(%normdelta,2));
%degZ = mRadtoDeg(getWord(%normdelta,3));
%rotation = %degX SPC %degY SPC %degZ;
%vehicle.setRotation(%rotation);

PLEASE, someone correct me if something is wrong.
#4
11/01/2004 (10:42 am)
Wouldn't %oldpos = %vehicle.getTransform(); be the current or new pos. You will need to save the old pos as a variable in the previous tick then use it later.
#5
11/01/2004 (12:52 pm)
This looks like it might work, ill try this later today Thanks.