Jump to content

NotTooManyItems

Resident
  • Posts

    2
  • Joined

  • Last visited

Reputation

1 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks! Dividing by llGetRot() did it! And the llSetLinkPrimitiveParamsFast() function made the rotation smoother!
  2. I've got a compass object worn on my avatar and would like it to always be rotated towards a location in world no matter what direction the avatar who wears it is facing. At the moment the object points in the correct direction but only when the avatar is facing North. Facing North - https://i.gyazo.com/bbd35b98bd439b2971448a12f1aaeeac.png Facing South - https://i.gyazo.com/def55de0ad493b0bd7d28b0a35d1a651.png In both images the arrow continues to point in the same way but the avatar is facing a different direction. I need the arrow to change to continue facing <0,0,0> when the avatar rotates. Code vector vTarget = <0,0,0>; vector vPos = llGetPos(); //object position float fDistance=llVecDist(<vTarget.x,vTarget.y,0>,<vPos.x,vPos.y,0>); // XY Distance, disregarding height differences. llSetRot(llRotBetween(<1,0,0>,llVecNorm(<fDistance,0,0>)) * llRotBetween(<1,0,0>,-llVecNorm(<vTarget.x - vPos.x,vTarget.y - vPos.y,0>))); SOLUTION vector vTarget = llList2Vector(waypoints, current_waypoint); rotation vRot = llGetRot(); vector vAvatar = llGetPos(); vector direction = (vTarget - vAvatar) / vRot; direction.z = 0; direction = llVecNorm(direction); rotation final = llRotBetween(<1,0,0>, -direction); llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROTATION, final]);
×
×
  • Create New...