Which pXent commands will apply force so model goes straight?

Posted By: bpc31

Which pXent commands will apply force so model goes straight? - 08/27/12 05:48

For example if I use pXent_setvelocity(my, vector(500, 0, 0)); //my boat moves along the X-axis not straight ahead. Somehow it needs to adjust based on the boats current pan?

Code:
if( key_cul ) pXent_addtorquelocal (my, vector(0, 0, 30000*time_step));
if( key_cur ) pXent_addtorquelocal (my, vector(0, 0, -30000*time_step));
if( key_cuu ) ???????

Posted By: MasterQ32

Re: Which pXent commands will apply force so model goes straight? - 08/27/12 07:17

you need a local vector for this. so you have to convert your speed to the local speed. this is simply done with vec_rotate:

Code:
VECTOR speed;
vec_set(speed, vector(500, 0, 0));
vec_rotate(speed, my.pan);
pXent_setvelocity(my, speed);

Posted By: bpc31

Re: Which pXent commands will apply force so model goes straight? - 08/27/12 08:26

That works great - Thanks so much!
© 2024 lite-C Forums