Noobish question regarding ground impact
|
|
Krori Straaf
Registered User
Join date: 5 Sep 2007
Posts: 2
|
09-05-2007 19:03
Hi everyone, sorry for what is probably a stupid question, but I've been pawing through the Wikis and repository for days and haven't found anything that really hit the mark.
Basically, I would like to create puffs of smoke/dirt whenever an avatar hits the ground at a suitable velocity. I'm not overly concerned with the aesthetics or getting the dirt to actually display, I basically just can't figure out how to determine ground collisions. I'm certain that the functionality to determine that stuff is built in, as SL already plays different animations if you fall from different heights, I'm just not sure how to access it.
The closest thing I could imagine would be a call to llGetBoundingBox checking for collision with the ground (which i'm not sure how to get), and then a call to llGetVel to see if I'm going fast enough to do anything about it. Even then, this solution would be largely dependent on time, and would be very inefficient (it should really only be run when you're colliding with the ground, but you weren't a moment ago).
Anyway, I'm sure I've rambled on long enough - if someone could point me in the right direction, I would be much obliged.
Thanks!
--Edit: Correct me if I'm wrong, but it looks like land_collision_start is what I'm looking for. Testing is in order!
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
09-05-2007 19:41
You could try llGetAgentInfo along with AGENT_WALKING. This would also still work even if you were walking on a prim floor.
Sounds like it is going to be a fun project for you. Keep us posted.
Once you get it working and if you want to use it all of the time then I would suggest inserting into the walk function of your AO. No use in two different scripts checking for the same thing.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
09-05-2007 20:41
I made something like this a while back, and if I remember right, I checked the avatar's velocity in the land collision event, and if the magnitude of that velocity was high enough (I don't remember the number I used), then it would rez an object at the avatar's feet (determined by using the avatar position minus half the height from llGetAgentSize. The rezzed object would generate the particles, wait for a second to ensure the particles got generated, and then llDie().
|
|
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
|
09-06-2007 12:44
Search the wiki for these Events: land_collision, land_collision_start, land_collision_end. 
|
|
Krori Straaf
Registered User
Join date: 5 Sep 2007
Posts: 2
|
09-06-2007 14:21
I was doing some more digging today while at work, and noticed that the llGetAnimation function can return "Standing Up", which means you're standing up after a long fall. Which means that once I get an AO object (still working with the noob anims), I can have it check for that, and if it finds it, send out the dust cloud. However, I think the timing would be a bit off for this (puff of smoke would occur shortly AFTER impact, rather than on impact itself). Also, I'd have to figure out some way to have the puff of smoke occur only once per impact, rather than every time the AO gets queried while you're getting up. There seems to be some confusion over what my intent is. My first day in second life, I discovered that my favorite thing to do was fly 50-70m up and then plummet back down. My intent is to have a "Wile E. Coyote"-style poof when I hit the ground in that case. Using the land_collision_start event, I triggered a (temporary) llOwnerSay with the velocity at time of impact, so I can determine a good velocity at which to trigger the poof. After sending the tell, it sleeps the script for a few seconds to prevent flooding. Of course, right now the script is attached to a lovely 0.5m cube jutting out from my stomach - aesthetics come last  Once I finish, I'll make sure to send a copy to everyone in this thread!
|
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
09-06-2007 16:10
Ya know, if you really like the "Wile E. Coyote" concept, you could add more to the script so that instead of just a dust cloud, it creates a hole where you landed.
Only work on your own land of course.
|
|
Tegg Bode
FrootLoop Roo Overlord
Join date: 12 Jan 2007
Posts: 5,707
|
09-07-2007 00:53
From: Jotheph Nemeth Ya know, if you really like the "Wile E. Coyote" concept, you could add more to the script so that instead of just a dust cloud, it creates a hole where you landed.
Only work on your own land of course. Not to forget the sign you hold up in the last 20m that says "OUCH!"
_____________________
Level 38 Builder [Roo Clan]
Free Waterside & Roadside Vehicle Rez Platform, Desire (88, 17, 107)
Avatars & Roadside Seaview shops and vendorspace for rent, $2.00/prim/week, Desire (175,48,107)
|
|
Danielz Shackle
Registered User
Join date: 30 Apr 2006
Posts: 100
|
09-07-2007 01:02
Well i noticed when trying this right now it doesnt always go from falling to standing. sometimes it walks a little etc..
so i think maybe have it check, and when it is falling trigger a variable to TRUE so you know the falling is/has been occuring
then for your normal check use somethign like if currentAnim != falling && fallingTrigger == TRUE
that will trigger as soon as anything other then the fall animation is used, but only after a fall. which can be quicker then waiting for your av to fully stand up.
(of course you ened to pretty it up and add small stuff, this was to give you idea)
|
|
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
|
09-07-2007 06:30
That sounds like a very good suggestion Danielz.
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
|