How do I detect local ground level and move a prim so it is resting on the ground?
A script snippet would be good.
These forums are CLOSED. Please visit the new forums HERE
Finding and going to local ground level? |
|
|
Nefertiti Nefarious
Registered User
Join date: 5 Oct 2006
Posts: 135
|
02-24-2008 05:06
How do I detect local ground level and move a prim so it is resting on the ground?
A script snippet would be good. |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
02-24-2008 06:27
How do I detect local ground level and move a prim so it is resting on the ground? A script snippet would be good. A simple question with many answers, depending on exactly what you are doing. llGround(<0.0,0.0,0.0> ; Give the ground height at the position you are at or;llGround(llGetPos() + <10.0, 0.0, 0.0> ; 10 meters in the x direction etc.............So if you are just moving down and it is only 10 meters or less then: CODE default {But if it is more then 10 meters then you are going to have to use something like a do-while loop: CODE default {And finally, remember that it is going to put the center of the prim/prims at ground level, which means half will be below ground level so you need to account for that accordingly: CODE default {_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-24-2008 11:56
Note also that you may not want to move to exactly the ground height. This will put the (uncut) center of your root prim at ground level, which is rarely what is meant by "sitting" on the ground. You could build the object specifically so that this works, or you could use some knowledge of your object's geometry to compute the height it should be above the ground, or you could try using llGetBoundingBox() for it. If your object is physical, or if it can be made physical until it comes to rest, you could also use a 'land_collision_start' event to know when to stop it.
|
|
Nefertiti Nefarious
Registered User
Join date: 5 Oct 2006
Posts: 135
|
02-24-2008 14:01
I'm trying to make a wandering prim, moves a short distance each time, but it keeps drifting off the slopes. A It goes uphill OK, but doesn't stay at ground level going downhill.
The object is physical, 1 prim. If I have to enter an offset to make it rest the bottom on the ground, I can hard-code that, or get the prim size and use a constant. But the 'land_collision_start' might work better. How would that work, assuming I have moved over to an xy that is above ground by a meter or so. |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
02-24-2008 15:36
I'm trying to make a wandering prim, moves a short distance each time, but it keeps drifting off the slopes. A It goes uphill OK, but doesn't stay at ground level going downhill. The object is physical, 1 prim. If I have to enter an offset to make it rest the bottom on the ground, I can hard-code that, or get the prim size and use a constant. But the 'land_collision_start' might work better. How would that work, assuming I have moved over to an xy that is above ground by a meter or so. For physical, take a look at llSetHoverHeight & llGroundRepel And for everything that could be applicable: http://www.cheesefactory.us/lslwm/land.htm _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-24-2008 20:33
But the 'land_collision_start' might work better. How would that work, assuming I have moved over to an xy that is above ground by a meter or so. Use another physical movement to go straight down (such as the llMoveToTarget() to the xy position and a height equal to ground height). Put a 'land_collision_start' event in your script state, and when it fires, stop the downwards movement (llStopMoveToTarget(), llMoveToTarget(llGetPos(), ...), move on to your next location, etc.). |