Doppie Westerburg
All around nice guy
Join date: 27 Mar 2004
Posts: 6
|
01-17-2005 16:05
Hi all  I have this object I want to move between two points, and I'm using Shack Dougalls 'autonavigation' script for that. (posted elsewhere in this forum - thanx Shack!) However, I want my object to turn in the direction its moving. And I cant get it to work. I did a search in this forum, and came up with a couple of posts, but either i am doing something wrong, or I dunno..... BTW please note my 3d math is kinda ...lets say... 'underdeveloped' I tried using llSetRot, llLookat, llRotLookAt, to no effect. The way i see it, i need to find out the angle between my current rotation and my destination and then rotate around my Z axis by that many degrees (possible converted to radians when needed). So far, it only does all kinds of weird rotation things, and just kinda tumbles about the place Any help sincerely appreciated! Doppie (your friendly neighborhood scripting apprentice)
|
Tread Whiplash
Crazy Crafter
Join date: 25 Dec 2004
Posts: 291
|
LSL Wiki...
01-17-2005 16:18
Try this page of the LSL Wiki... "llRotBetween". It takes two vectors and gives you the rotation amount between them: http://secondlife.com/badgeo/wakka.php?wakka=llRotBetweenEnjoy! Take care, --Noel "HB" Wade (Tread Whiplash)
|
Doppie Westerburg
All around nice guy
Join date: 27 Mar 2004
Posts: 6
|
01-17-2005 16:59
Thanks for your reply I tried that actually, but the thing that is giving me the most trouble, is that my object doesnt just seem to like to move on my Z axis only. Does all these weird things on other axies too... Also, doesnt that function want two directional vectors? As opposed to locations? And what would you use to do the actual rotation? llLookat? llSetPos? Other? Pardon my complete cluelesness here... doppie
|
Driftwood Nomad
Registered User
Join date: 10 May 2003
Posts: 451
|
01-17-2005 17:45
llRotLookAt() should work, but you must make sure that your forward vector is set properly. When you create the object, create it with rotation 0,0,0, and make sure the front part of the object is facing North. That's how I've done it before and it seems to work for me.
|
Stinky Queso
Second Life Resident
Join date: 29 Nov 2004
Posts: 53
|
01-18-2005 21:27
make sure you dont have any llSetStatus(STATUS_ROTATE_Y, FALSE) or whatever in there, that can cause messed up rotations. Other than that, keep in mind you can add and subtract euler rotations with a simple llEuler2Rot(DEG_TO_RAD * <eul rotation here>  ; good luck
|