Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Using llGetMass For jumping only

Drizzt Naumova
Teh Foxeh DJ
Join date: 9 Oct 2005
Posts: 116
08-19-2006 09:02
Greetings.
I have been trying to get this to work, but so far no luck...
What I want to do is make myself lighter so I can do a higher and farther jump using llGetMass() *5.0, But every way I have tried it comes up with different compile errors.
I want the llGetMass to trigger only on Jumping, as just setting a mass for attach and not specifying any animtions will make me lighter while walking and jumping, making it hard to stop. Is this possible? Any help appreciated :)
Thanks in advance,

~Drizzt~
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
08-19-2006 09:15
Not too sure exactly how you're going about this. You mention llGetMass() but this will only ever return a number equal to the mass of the object (or in the case of attachments the avatar (if I recall correctly)). You still need to apply this number somehow, usually using llApplyImpulse or llSetForce. I'd recommend using llApplyImpulse, to use it you'll need to take the agent's controls (just as you would for a vehicle) and whenever you see the move up control and your avatar is not in a flying animation (found by obtaining the animations list for your avatar) then you can apply an impulse in the vertical direction with a magnitude of llGetMass() * something.
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Drizzt Naumova
Teh Foxeh DJ
Join date: 9 Oct 2005
Posts: 116
08-19-2006 10:45
ahh ok. then attach(key avatar) would be ok. here is what i am working with. can't figure out where to insert the trgger at. here is what i have so far, but not sure where to insert the part about (anim=="Jumping";)


CODE

default
{
attach(key avatar)
{
vector force = <0,0, llGetMass() * 5.0>;
llSetForce(force, TRUE);
if(avatar==NULL_KEY)
{
llSetForce(<0,0,0>,TRUE);
}
}
}
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
08-19-2006 10:58
I think buoyancy might help you here, here's my very simple "moon gravity attachment" script:

CODE

default
{

attach(key avatar)
{
llSetBuoyancy (0.7);
if(avatar==NULL_KEY)
{
llSetBuoyancy (0.0);
}
}
}


This one starts as soon as you wear it, for what you want I think you'd either stick a call to llSetBuoyancy in an anim override or make a simple one to detect only when you're jumping, and at that point set buoyancy to 0.7 (or a different number depending on how "light" you want to be), else set buoyancy back to 0.
Drizzt Naumova
Teh Foxeh DJ
Join date: 9 Oct 2005
Posts: 116
08-19-2006 13:20
hmm, still can't seen to get it to do right..but not sure why. Still learning lsl :P


CODE


default
{

attach(key avatar)
{
llSetBuoyancy (0.7);
if(avatar==NULL_KEY)
{
llSetBuoyancy (0.0);
}
else if(anim == "Jumping")
llSetBuoyancy (0.7,TRUE);
}

}


This obviously gives back a name not defined within scope error. Still sorta hung on this one :(
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
08-19-2006 15:08
Hmm, maybe try something like this, then...

CODE

float ModPush = 10; // Push modifier, raise or lower this to change the amount of push applied

default {
state_entry() {
llSetTimerEvent(0.5);
}

timer() {

if(llGetAnimation(llGetOwner()) == "PreJumping" )
{
llPushObject(llGetOwner(),llGetMass()*<0,0,ModPush>,ZERO_VECTOR,FALSE);
}


}

}
Drizzt Naumova
Teh Foxeh DJ
Join date: 9 Oct 2005
Posts: 116
Works Like A Charm
08-19-2006 20:48
Thanks :D

Exactly what I was reffering to. Works awesome with a 3.4 modifier. :D