Jump to content

Making an object face the direction it's travelling


Shanbo Baddingham
 Share

You are about to reply to a thread that has been inactive for 1529 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi there.  I''m  making a script where a non-physical sculptie in the shape of a floating skull is wandering around.  Problem, is the skull is facing a direction different from the direction it's travelling.  I tried llLookAt, but the skull then moves around it's z-axis, meaning it's top is pointed toward the destination instead of the face.   Anyone know how to make it so that it's oriented correctly, or how to find a rotation to make it face the right direction?

  • Like 1
Link to comment
Share on other sites

Since you're using a sculptie, I suspect that the sculpt's own axes aren't aligned with those of a conventional prim -- that is, that when you look at your sculpt in the editor using the local ruler (as opposed to the default world one) the red arrow isn't pointing in the same direction in which the skull is looking.

If that's the case, then the problem is that, by default, LSL assumes that moving forwards means moving on the object's positive x axis.  

The simplest solution by far, if that's the problem, is to put your scripts in a small cube prim, make it invisible and then link your skull sculptie to it as a child prim.  Adjust the skull so it's looking forwards along the root prim's positive x axis, and all should be well.

 

  • Like 4
Link to comment
Share on other sites

I have exactly the item you're making. Well, more or less; it's a floating skull. Mine also talks via chat commands, poofs when out of range, and dies on command for easy cleanup. I use it to raise eyebrows sometimes at Avilion... it's kinda creepy tho. His name is Crudrick Halfnutsz, late Duke of Noob'ry, lol. He doesn't just wander, but follows me, and he used to follow anyone who got within range, like a zombie NPC or something.

Here's how I sorted my two issues with the facing and movement of a human skull (which I definitely had issues with, as it was mesh and mesh acts funky sometimes):

First off, he didn't want to move smoothly until I encased him in a cylindrical prim (set to transparent and linked as root) and set the skull inside to the height I wanted. Basically what Innula reccommended up there ^. Before that he either skipped across the ground or sort of tumbled in the air, so this sorted that issue.

Secondly, the only way I could get him to face the proper direction otherwise was to orient him correctly before uploading, so he came in facing East. Then even the simplest follower script would put him facing me when he moves. But even this isn't necessary using the transparent prim method above. Plus the movement is smoother.

I know it's a tad redundant, but I had to chime in, as it's about something dear to my heart: decapitated skulls floating around and stalking me. xD

Edited by Berksey
  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1529 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...