Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rezzing on ground, not ground level

Keumjoo Ahn
Registered User
Join date: 13 Jan 2007
Posts: 15
09-06-2007 02:12
Hello,

I am a total beginner and have a problem that drives me nuts O.o
I try to wear a trigger and let it rez something on the ground. this works as far as the "ground" is groundlevel as I use the findgroundorwater function.
BUT mostly the ground i am walking on is not groundlevel (Prims above the groundlevel, showing grass, street, housefloor..). So if i try to rez my object here, its on groundlevel, but out of sight..(omg i hope you know what i mean..O.o)

Errr, what can i do to rez my object to the feet of my avatar? No matter on what i stand on?
*rubs her eyes that start hurting from all the search*
I am thankful for any help *rubs again*
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
09-06-2007 02:25
Simple.

Get your avatars position and size
Subtract half the avatars size from its position.

That gives you the "ground level".
Keumjoo Ahn
Registered User
Join date: 13 Jan 2007
Posts: 15
09-06-2007 02:34
aw sounds logical^^ buddum..how do I found out the avatars position and size? O.o

~*feels goof and tries to look as if she understand whats going on*~
Domino Marama
Domino Designs
Join date: 22 Sep 2006
Posts: 1,126
09-06-2007 02:53
Getting the exact "floor" height is tricky. You should be able to get close with a combination of getting your position and height. You subtract about 55% ( half is close but exact amount depends on avatar shape ) of your height from your position Z co-ordinate and add 1m or so for the X distance in front of you (adjusted by your rotation) to the co-ordinates to rez at.

You'll also need to add half the height of the object to the Z co-ordinate. There's no way to detect this prior to rezzing, so you'll need to store this in a notecard or in the script (if the objects don't change).

Stuff you'll need to use to determine the position include:

https://wiki.secondlife.com/wiki/LlDetectedKey
https://wiki.secondlife.com/wiki/LlDetectedPos
https://wiki.secondlife.com/wiki/LlDetectedRot
https://wiki.secondlife.com/wiki/LlGetAgentSize

Put the calculation in the touch start event so if you change shapes between clicks it'll still work.

https://wiki.secondlife.com/wiki/Touch_start
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
09-06-2007 14:42
From: Keumjoo Ahn
aw sounds logical^^ buddum..how do I found out the avatars position and size? O.o

~*feels goof and tries to look as if she understand whats going on*~


You said you're wearing the object, so you can use the touch event and the detected functions as Domino linked.

But if you want the trigger to rez the object from a listen event or just on a timer, you'll want to use these functions instead:

vector pos = llGetPos();
vector size= llGetAgentSize(llGetOwner());

You might also want the agent's rotation if you want the trigger to rez the object in front of you rather than at your feet.

vector rot = llRot2Euler(llGetRotation());
Keumjoo Ahn
Registered User
Join date: 13 Jan 2007
Posts: 15
09-07-2007 13:55
aw thank you very much, its working perfect!!!!!!!!!

~*blows kiss*~