Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

OMG -- another question... about sitting people down

Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
07-12-2004 01:27
Is there any way to force the direction a person sits when they sit on a prim?
Moopf Murray
Moopfmerising
Join date: 7 Jan 2004
Posts: 2,448
07-12-2004 01:32
The function you're after is llSitTarget (http://www.badgeometry.com/wiki/llSitTarget)

It's good practice (well it makes your life easier!) if the prim you're going to use llSitTarget on is pointing in the correct direction, e.g. X forward and Z up, as that way you can use ZERO_ROTATION for the rotation for the rotation parameter, e.g.

llSitTarget(<0.1,0,0>,ZERO_ROTATION);
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
07-12-2004 02:59
Not much is working for me tonight.

I have had to rotate the prim, and no matter what I set the rotation to, I cannot get my avatar to FACE FORWARD. This is a seat in a vehicle and no matter what, he always sits facing to the side.

CODE
    state_entry()
{
llSitTarget(<0, 0, 0.4>, <0, 0, 0, 1.0>);
}


In the rotation vector, if I make changes in the first two, I see major changes in the world... ie, the avatar sists upside down, but I can't seem to get him to rotate on the X axis so he's facing forward in relation to the prim.
Siggy Romulus
DILLIGAF
Join date: 22 Sep 2003
Posts: 5,711
07-12-2004 03:53
From: someone
Originally posted by Aaron Levy

CODE
    state_entry()
{
llSitTarget(<0, 0, 0.4>, <0, 0, 0, 1.0>);
}


In the rotation vector, if I make changes in the first two, I see major changes in the world... ie, the avatar sists upside down, but I can't seem to get him to rotate on the X axis so he's facing forward in relation to the prim.


Okies, my skills at trying to explain things are usually pretty woefull, but I'll give it a try.

What Moopf is saying is that if this prim were a simple cube - for say the base of a chair, if you use his offset and rotation it will face forward - IF your prim is set to 0,0,0 in your edit box.
(<0,0,0,1.0> is a rotation value for ZERO_ROTATION)

The easy way would be to sit on this prim, align it to your vehicle that way.

Rotation values are expressed in quanterions, which is beyond the scope of a forum reply to get into, although under rotations on the LSL wiki there are excellent links to read up on.

Suffice to say that if you can't do it this way, you'll have to calculate a new rotation. Here is an easy way - I did this to align an AV to sit on a cut prim for my lil lay-z-boy chair:

sit your seat down at zero rotation, sit on a cube set to zero rotation (using your sittarget script - like what moopf gave you). Move your seated av into position so it matches your seat.

So now the prim your sitting on will give you the value you need, but its expressed as a euler <x,y,z> - and what you need is a quanterion.

So convert it to radians : vector euler *= DEG_TO_RAD.
Then plug this value into into llEuler2Rot()

Thats a fairly easy way to get what you need without having to really understand what your doing -- although I'd advise reading up anyway...

(I'm sure someone will correct me if I screwed up, its really really early in the morn for me)

Siggy.
_____________________
The Second Life forums are living proof as to why it's illegal for people to have sex with farm animals.

From: Jesse Linden
I, for one, am highly un-helped by this thread