Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Parachute Script

Remos Hayashi
Scripter
Join date: 15 Aug 2006
Posts: 6
09-08-2006 00:18
Ok, I would like to make a parachute but I don't really know how i can make it slow me down while i'm falling; So, can anyone point me in the right direction or help me in anyway?

P.S I'm in SL right now.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
09-08-2006 02:03
Never actually tried, but either incrementally move llSetBuoyancy closer to 0 or apply a gradually increasing (but limited) impulse upwards would be the two places I'd start with.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Remos Hayashi
Scripter
Join date: 15 Aug 2006
Posts: 6
09-08-2006 04:15
i'll try that now; Thanks :)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Ok, (i'm editing my post as to not double post) i tried that and it looks like all that happens is that the peak of my jump is a little higher but it does not really slow me down when i'm decending.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
09-08-2006 06:17
The point about parachutes is that they don't change the force of gravity (obviously) but they do apply drag. Drag is proportional to the square of your velocity. Eventually the drag equals the force of gravity, so there is no net force on you any more and you continue moving downwards at a constant speed.

Try putting something like in an attachment:
CODE
// Parachute script
// Applies a drag force in the Z-direction only,
// to change terminal velocity

// Ordinal Malaprop
// 2006-09-08

float gFallSpeed = 2.0;
float gCoefficient = 0.0;

default
{
state_entry()
{
// Calculate drag coefficient based on desired speed
gCoefficient = 9.8 / (gFallSpeed * gFallSpeed);
// Correct drag force regularly
llSetTimerEvent(0.1);
}

timer()
{
// Drag only applies in the Z-direction, and only downwards
vector vel = llGetVel();
float speed = vel.z;
if (speed > 0.0) speed = 0.0;
vector drag = llGetMass() * gCoefficient * speed * speed * <0.0, 0.0, 1.0>;
// Apply force
llSetForce(drag, 0);
}
}

just off the top of my head there - I've not tried it personally. It won't affect anything except vertical movement.

edit: whoops, that one would have the force going in the wrong direction! fixed now
Remos Hayashi
Scripter
Join date: 15 Aug 2006
Posts: 6
09-08-2006 06:55
:D thanks i'm gonna go try this now:D
______________
:D YAY!!!! :D it works :) thank you.