So what I have is a child prim (a flat arrow on the ground, child prim. Root prim invisible at 0,0,0)
The Arrow (A bit like the twister game perhaps?) I have spinning round and slowing down.
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL, llGetLocalRot() * llEuler2Rot(<0., 0., spin> * DEG_TO_RAD)]);
The above in a timer inside the child (arrow) prim. All good and well, it spins as it should.
However, I want it to spin round perhaps two times then find an avatar and spin and stop so it then points at the avatar.
I have used a sensor to choose a random avi, that's done. Grab their pos and work out rotation for the arrow to be able to point to the avi. Something like:
vector target = llDetectedPos(chosen avi);
vector gvPos=llGetPos(); //object position
float gfDistance=llVecDist(<gvTarget.x,gvTarget.y,0>,<gvPos.x,gvPos.y,0>);
llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_ROT_LOCAL, llRotBetween(<0.00001,0,0>,llVecNorm(<gvTarget.x - gvPos.x, gvTarget.y - gvPos.y,0>)/llGetRootRotation()) ]);
Which is fine, if I wanted the llRotBetween, but I do not as it will make the arrow spin either clockwise or anti, as it works out the shortest distance!
Also, I tried taking the value of the above as a Rotation and during the arrow spin, does Rotation == llGetRot() (after doing euler stuff degtorad to get the rot.z)
However, the chances of the original spin's rot.z ever matching the above rot.z is limited as each spin will have a different value.
Pulling my hair out! Headaches!
So, here is where I need help.
Arrow spins at least 2 times round (360 x2)?
Finds an avi then keeps spinning in same direction then stops to point at chosen avi.
Oh and is it possible no matter which rotation the root is in to still have this work? As I don't want to have to deal with that too!
Sounds simple on paper and probably is, but after messing about with euler and rotations things are getting messy!
Thank you for any tips or help you may give