Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

I hate rotations ;)

Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
09-10-2008 15:31
Hi pholks...

I try to move an object (duh) when it reaches target (or a boundary), it should turn itself into another direction and then move on...

I'm using this:

CODE


float new_x = (float)randIntBetween(1, (integer)gMaxDistance) / 2;

if(new_x > 64.0)
new_x = 63.0;

float new_y = (float)randIntBetween(1, (integer)gMaxDistance) / new_x;

if(new_y > 64.0)
new_y = 63.0;

llSetRot( llEuler2Rot( <0.0, 0.0, llFrand( PI ) - PI_BY_TWO> ) * llGetRot());
llSleep(1.5);
vector target = llGetPos() + <new_x, new_y, 0.0> * llGetRot();



vector target is obiviously the new target I'm moving the object to.

To my understanding, the object should alwas go «forward», but sometimes it goes sideways as well. What am I doing wrong?

Thanks for your help...
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
09-10-2008 16:34
The new_y when assigning the target makes the target shift sideways respective to the rotation of the object, so if you didn't mean to do that just eliminate it, so it therefore should only be...
vector target = llGetPos() + <new_x, 0.0, 0.0> * llGetRot();
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
09-11-2008 05:21
Thanks Nexii... these are the moments that make me go «duh» ;)