Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking where it's going?

Enrico Genosse
Registered User
Join date: 11 Jun 2006
Posts: 5
06-19-2006 13:02
Hi,

I'm trying to make my object look in the direction it's going. Everything I try flips it in some odd angle -- not in the direction of the target. This is my code:

goto( vector target ) {
llSay( 0, "Moving to " + (string) target );
llSetStatus(STATUS_PHANTOM, TRUE);
// llRotLookAt( llEuler2Rot( target ), .1, 1 );
// llLookAt( llGetPos() - target, .1, 1 );
llMoveToTarget( target, 1 );
}

The llMoveToTarget() works fine. Ive tried several versions of llLookAt and llRotLookAt, but with no luck.

(I removed error checking other code for simplicity.)

I have a feeling it has to do with some relative rotation of my object or something, but I can't figure it out.

'elp!
Bounder Jimenez
programmer/designer
Join date: 12 Oct 2005
Posts: 45
06-19-2006 13:12
Try changing the orientation of your root prim of the item. llLookAt will cause the greater X face to look at the direction you want. Try it with a cube that has a face colored and watch the effect of llLookAt. Use llLookAt(target,1.0,1.0);
Enrico Genosse
Registered User
Join date: 11 Jun 2006
Posts: 5
Getting closer.
06-19-2006 14:29
Thanks, that helped clarify things, but I still don't have it right.

My object points it "top" toward the target rather than the "front"! I believe I have it oriented so that it's front faces the positive-x direction.

I judge that by x, y, and z lines when I go to edit it's position. Is there some way to code it's orientation? Or is there some kind of transformation I can do to "target" so that the front will point toward it?

Thanks!

-- E

(later...) I decided to redesign the object to avoid this problem, but is someone knows the answer, I'd still like to here it....
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
06-19-2006 16:30
Edit linked parts
Select the root prim (the one with the yellow outline)
Change the coordinates from World to Local

The direction in which the red arrow points, is the direction in which your object 'faces'.
Enrico Genosse
Registered User
Join date: 11 Jun 2006
Posts: 5
Beautiful!
06-20-2006 08:22
That did the trick, thanks so much!

-- EG