Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

need help with a diving board script

Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
05-19-2007 19:30
i found this script in a tramploine or something i was wondering if it was possible to combine the 2 llPushObejct parts into one since it seems only one is working at a time.

CODE
float force_amount = 100.0;
float fwd_amount = 100.0;

default
{
collision(integer tnum)
{
llTriggerSound("trampoline", 1.0);
if (llDetectedType(0) & AGENT)
llPushObject(llDetectedKey(0), force_amount*llRot2Up(llGetRot()), ZERO_VECTOR, FALSE);//want to combine these 2
llPushObject(llDetectedKey(0), fwd_amount*llRot2Fwd(llGetRot()), ZERO_VECTOR, FALSE);//want to combine these 2
llSetText("Touch to dive!", <1.0,0.0,0.0>, 1);
}
}
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
05-20-2007 15:48
Lol, anyone? I know there is some math involved but I'm not good with that. I know you math wizes would like to take a stab at that. :D
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
05-20-2007 16:27
lol, nevermind with the help of a friend we figured it out.

CODE
float force_amount = 100.0;
float fwd_amount = -100.0;

default
{
state_entry()
{
llSetText("Touch to dive!", <1.0,0.0,0.0>, 1);
}
collision(integer tnum)
{
llTriggerSound("trampoline", 1.0);
if (llDetectedType(0) & AGENT)
{
llPushObject(llDetectedKey(0), force_amount*llRot2Up(llGetRot()) + fwd_amount*llRot2Fwd(llGetRot()), ZERO_VECTOR, FALSE);
}
}
}
Damanios Thetan
looking in
Join date: 6 Mar 2004
Posts: 992
05-20-2007 19:21
The behaviour of the second script will be a little different then the first one though.

This has to do with the way the force of llPushObject is calculated. It is dependent of the distance the 'pushed' object/avatar is from the pushing object.

In the first example the avatar is already pushed in the air by the first call, so it's a little further apart from the pushing object, when the second call triggers the forward push.

In the second script the object gets both pushes at the same distance from the pushing object, so the forward strength will probably be a little greater.

As the push calls follow rapidly after another in the first script, the resulting difference should be negligible though.
_____________________