Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

above or below ground?

Andurant Proudfoot
Registered User
Join date: 11 Jul 2004
Posts: 27
03-12-2005 16:12
Anyone know how I can, from a given vector, determine the vector of the ground surface immediately below that?

It's for a scripting/building project I'm doing, and I'm having some difficulty with this. I want to generate a random 'Z' point in a vector, but guarantee that it ends up above ground.

Doable? Advice?

Thanks in advance
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-12-2005 16:54
CODE
vector rand = <llFrand(256),llFrand(256),llFrand(256)>;
rand.z += llGround(rand);
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
McWheelie Baldwin
Registered User
Join date: 9 Apr 2004
Posts: 154
03-14-2005 11:15
I could be wrong, but doesn't llGround return the default ground height? So if you have edited the land in any way, the returned value is no longer accurate. At least this seems to be my experience with llGround thus far.

McW
_____________________


Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-14-2005 12:51
From: McWheelie Baldwin
I could be wrong, but doesn't llGround return the default ground height? So if you have edited the land in any way, the returned value is no longer accurate. At least this seems to be my experience with llGround thus far.

McW


That doesn't sound right. If that is happening you should bug report it. I only say this because if that were the case then llGround wouldn't work in any of the pre 1.3 sims where the original ground height was never recorded (and thus you can't restore the ground to that height). The revert land tool was added I think in 1.3
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-14-2005 17:36
Photocopied off the wiki. I also have extensive experience with this function:

From: someone
http://secondlife.com/badgeo/wakka.php?wakka=llGround

float llGround(vector offset)

Returns the ground height at the current position + offset.

To actually change the ground height, use llModifyLand.

More details on land.

See llGroundContour, llGroundSlope, llGroundNormal and llSetHoverHeight.

I would say make sure your offset vector is correct. My guess is you're calling llGround(llGetPos());, which is incorrect. You want llGround(ZERO_VECTOR);. Default height is probably being called because you're requesting data outside of a sim, or in an area where ground "does not exist" (like areas that are simless).
_____________________
---
McWheelie Baldwin
Registered User
Join date: 9 Apr 2004
Posts: 154
03-15-2005 09:06
From: Jeffrey Gomez
Photocopied off the wiki. I also have extensive experience with this function:


I would say make sure your offset vector is correct. My guess is you're calling llGround(llGetPos());, which is incorrect. You want llGround(ZERO_VECTOR);. Default height is probably being called because you're requesting data outside of a sim, or in an area where ground "does not exist" (like areas that are simless).


You're absolutely right Jeffrey, I have been calling it wrong all along. I have read the Wiki page a few times, and have completely overlooked the 'object position + offset' part. I am not sure if it's always been listed that way, but yeah, I have obviously been using it wrong. Thanks for the info. Don't I feel dumb now. ;)

McW
_____________________