Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Land Detection/Collision

Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
11-27-2009 05:33
Hi guys,

I would like to detect (after falling from a Sky-platform) when my avatar is within 50m, 20m, 10m, 5m of the ground, so I can implement different poses (to effect a more graceful, super-hero type of anim instead of crashing into the ground, standing up and dusting yourself off, as is currently the case.

Can someone point me to the two commands at the core of this little project, the ground detection event and the ground collision event. I have read the LSL Wiki on collisions and after a while my eyes glazed over.

Many thanks

Rock
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
11-27-2009 06:35
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGround
for the land level
and
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetPos
or
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetRootPosition
for the position of some attached object.

alternatively use
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetObjectDetails
to get the agents position and velocity if you want.
_____________________
From Studio Dora
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
11-27-2009 06:44


Thanks for that Dora. I see you are detecting collision with the ground by comparing the height of the ground with the position of whatever attachment the avatar is wearing containing the script. So do I take it that you are approaching it this way because there is no actual ground collision event?

Of course, thinking about this some more (just formulating my plan of attack while at work, will get a chance to get my hands dirty when I get home, for the weekend) the avatar could be falling towards the roof of a house, or a bridge, and I would have to detect the approach to those too.

Seemed easy at first :)

Thanks

Rock
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
11-27-2009 07:49
From: Rock Vacirca
So do I take it that you are approaching it this way because there is no actual ground collision event?
There is a ground collision event but it will not take place until you collide with the ground:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=land_collision
You are right that my plan is to compute the distance between agent and ground and take action on that. This is what is done in a parachute with automatic pull.
If you want to include buildings on the land or in the sky you would implement a sensor. That is not simple though because the detected distance is to the object center and an object may have surfaces plenty of meters away from its center
_____________________
From Studio Dora