Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Trampoline script PLEEASE!

Krikket Teevee
Registered User
Join date: 10 Dec 2003
Posts: 17
09-20-2004 16:32
hmmm.. any of you coding studs want to show me your trampoline script?? :o)
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
09-20-2004 20:53
Krikket, Check out my 'Bouncy Room' which is located in Mesede (don't have exact coordinates but it's the southwest corner) and if this is the type of "trampoline script" you are after I may be able to help you.
Nick Fortune
National Alchemist
Join date: 30 May 2003
Posts: 74
09-20-2004 23:22
CODE

//

float force_amount = 40.0;


default
{
collision(integer tnum)
{
if (llDetectedType(0) & AGENT)
llPushObject(llDetectedKey(0), force_amount*llRot2Up(llGetRot()),ZERO_VECTOR, FALSE);
}
}


I picked this off of of something forever ago. I think it was a Linden Trampoline, but im not sure. I havent once cleaned out my script folder and its getting scary in there.
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
09-20-2004 23:39
I'd recommend a few changes to your script Nick.
changes:
*uses collision_start instead of collision().
*keep the code inside the collision_start() as simple as possible so that the bouncing happens as fast as possible.

Also I've found that if you use llVolumeDetect() on the trampoline prim then the bouncy effect works better as it gives the script time to run the code before you actually hit the prim. It also stops you landing on the prim instead of bouncing evenly.

CODE
float force_amount = 20.0;

default
{
collision_start(integer tnum)
{
if (llDetectedType(0) & AGENT)
{
llPushObject(llDetectedKey(0), <0,0,force_amount>, ZERO_VECTOR, FALSE);
}
}
}
Nick Fortune
National Alchemist
Join date: 30 May 2003
Posts: 74
09-21-2004 00:42
From: someone
Originally posted by Rysidian Rubio
I'd recommend a few changes to your script Nick.
changes:
*uses collision_start instead of collision().
*keep the code inside the collision_start() as simple as possible so that the bouncing happens as fast as possible.

Also I've found that if you use llVolumeDetect() on the trampoline prim then the bouncy effect works better as it gives the script time to run the code before you actually hit the prim. It also stops you landing on the prim instead of bouncing evenly.

CODE
float force_amount = 20.0;

default
{
collision_start(integer tnum)
{
if (llDetectedType(0) & AGENT)
{
llPushObject(llDetectedKey(0), <0,0,force_amount>, ZERO_VECTOR, FALSE);
}
}
}



Well lol, like i said. I didnt write it, i was just offering it up as an example.
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
09-21-2004 07:12
From: someone
Originally posted by Nick Fortune
Well lol, like i said. I didnt write it, i was just offering it up as an example.


hehe I know but it's a good start :)
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-21-2004 09:12
Oh thanks for the script! I'll have to play with that and see if it will work for my application!
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
09-21-2004 09:51
That will just bounce you up, to bounce away (in whatever direction "away" is) you could try

CODE

vector vForce;
if (llDetectedType(0) & AGENT)
{
vForce = llVecNorm(llDetectedPos(0) - llGetPos());
vForce = vForce * force_amount;
llPushObject(llDetectedKey(0), vForce, ZERO_VECTOR, FALSE);
}
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-21-2004 12:42
Cool, I'll try that too!
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Krikket Teevee
Registered User
Join date: 10 Dec 2003
Posts: 17
09-21-2004 13:53
KEWL, thanks a lot guys ;)