Jump to content

Walk on Water Scripting?


Darla Hadisson
 Share

You are about to reply to a thread that has been inactive for 2979 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am trying to create a script that will allow me to walk on the surface of Linden water.  I got a couple of questions:

1. The position that I stand, is that the X, Y or Z position?

2. How would I have to start the script?  Like, say, if I were to wear the object on my feet and activate it right away, but if I were to set the standing position (X, Y or Z) to only allow my feet to not go below a certain position, what would I do?

Link to comment
Share on other sites

When you use llGetPos() to determine an av's position, you are finding where it's body's center is.  That's somewhere just south of where your navel is.  Your feet are half a body height below that. In theory, since

vector AvSize = llGetAgentSize;

your feet should be at llGetPos() - <0.0,0.0,AvSize.z/2.0> .  In theory. Not taking shoes into account and not taking the fact the the function doesn't measure your height quite correctly.

Your approach seems logical, attaching the scripted object to your feet. Still, calling llGetPos() will not report the object's position.  It will report your body's center, so you would still need that offset vector.

Unfortunately, though, your logical approach doesn't solve this scripting problem. It's a blind alley. You can't use LSL to move an av, and if you use llSetPos() or the other logical alternatives to move the attachment, that's all it will do -- move the attachment relative to your av's position.  The solution, then is to forget about using an attachment.  Put your script in something that you sit on, because you can move that and you can script it to stay at a precise height relative to llWater().

Once you sit on the object, you can use a control event to let you move with your keyboard arrow keys or (if you are in mouselook) with your mouse. You can also manage a walking animation that will make it look like you are walking despite the fact that you are really sitting. You'll need to start your script by using a changed event to detect when you have sat.  That action will automatically give you permission to trigger animations and to take control, but you will still need to go through the formal step of requesting permission and then putting your llTakeControls() function in a run_time_permissions event.

That's not actually as tricky as it sounds.  It's exactly what the swim devices you buy in SL do, only they trigger a swimming animation instead of a walking one.  You might be able to find a freebie one to examine for inspiration.  Resist the temptation to copy it, because you need the practice and because it probably won't do exactly what you want anyway.

 

Link to comment
Share on other sites

Incidentally, I woke up this morning with the faint memory of a completely different solution that someone discussd here in the LSL Scripting forum many years ago.  Basically, the idea was to script a transparent flat prim as a follower that stays at water level and always has its center a bit ahead of where you are.  You walk forward and the "follower" moves ahead of you.  You walk onto the follower instead of onto the water.  I don't know whether the idea worked, but I remember thinking that it was pretty clever.

Link to comment
Share on other sites

An "advance follower" would require land permissions to rez objects, or at least to let an already-rezzed object enter the parcel, and run scripts, etc. 

To some limited degree an attachment can move its avatar using physics. It can llSetBuoyancy, for example, and push its wearer around with llSetForce (and maybe llApplyImpulse). In my experience, though, the motion isn't very predictable (especially at sim crossings and other transitions) -- and would still need to llTakeControls and override at least the "Falling Down" animation -- so I don't think this is an easy starter script, if it's even possible to get an acceptable result.

It's been literally years since I played with this, so I don't even know whether the current generation of Havok makes it better or worse than it used to be.

Link to comment
Share on other sites

Yeah, those are important limitations, so it's not a perfect solution, Qie.  If the OP wanted to be able to walk on water on her own land, though, it might be worth a try. In other places, it still might work if the perms were right.

Using llSetForce or llApplyImpulse in an attachment gives really erratic results, I've found.  I have done that in a sort of "fun house" area to bounce avs around a bit.  I could be wrong, but I doubt that you could use it for anything like walking in a straight line.

Link to comment
Share on other sites

Back when I scripted those stairs, I tried to make something I could wear that would allow me to walk around in the air. The physics calls didn't work at all, because they depend on script timing and are subject to lag. Actual collisions between avatars and objects run at higher priority, and so are much more dependable. Attachments are phantom, so there's no way to use them as a collision surface for/of the avatar.

I agree that you can't wear anything that gives the desired effect.

Link to comment
Share on other sites

My water walker works by rezzing temp prims under my feet and the effect is very nice. It's simply a worn HUD with an on/off switch.

But as Qie pointed out you have to have rez rights for it to work.  

I do have to remember  to turn it off before sitting in a boat or it will capsize it.  :D

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2979 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...