Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

object launching trouble (Timing)

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
03-08-2008 17:04
i was to lazy tonight to make my own launching script so ive been editing this one, the trouble is the rocket is launching from a plane going 30+ mps when it launches it has a delay with the timer im trying to get rid of that delay. the rocket will spawn stay frozen for .1 seconds then launch by that time the plane normaly loses alt very slightly and the rocket nails you in the back end anyone have any isdea what i could do or any ways to fix my little issue

CODE

float gTotalTime = 0.0;
float gTimeStep = 0.1;

float FLIGHT_TIME = 6.0;
float THRUST = 15.0;

integer launched = FALSE;

launch()
{
launched = TRUE;
gTotalTime = 0.0;
llSetStatus(STATUS_PHYSICS, TRUE);
llSetForce(<0,0,THRUST>, TRUE);
llSetTimerEvent(gTimeStep);
llTriggerSound("launch", 1.0);
llMakeExplosion(20, 1.0, 5, 3.0, 1.0, "smoke", ZERO_VECTOR);
}
default
{
state_entry()
{
llSetBuoyancy(1.0);
llPreloadSound("launch");
llPreloadSound("explosion");
llSetStatus(STATUS_PHYSICS, FALSE);
}
on_rez(integer param)
{
if (param > 0)
{
llSetStatus(STATUS_PHYSICS,TRUE);
llSetTimerEvent(.1); // Wait passed number seconds then launch
}
}
timer()
{
if (!launched)
{
launch();
return;
}
gTotalTime += gTimeStep;
if (gTotalTime < FLIGHT_TIME)
{
llMakeExplosion(5, 1.0, 2, 3.0, PI, "smoke", ZERO_VECTOR);
}
else
{
llSetStatus(STATUS_PHYSICS, FALSE);
llSetForce(<0,0,0>, TRUE);
llTriggerSound("explosion", 10.0);
llMakeExplosion(20, 1.0, 10, 3.0, 1.0, "green", ZERO_VECTOR);
llMakeExplosion(20, 1.0, 10, 3.0, 1.0, "blue", ZERO_VECTOR);
llDie();
}
}
collision_start(integer num)
{
llSetStatus(STATUS_PHYSICS, FALSE);
llSetForce(<0,0,0>, TRUE);
llTriggerSound("explosion", 10.0);
llMakeExplosion(20, 1.0, 5, 3.0, 1.0, "green", ZERO_VECTOR);
llMakeExplosion(20, 1.0, 5, 3.0, 1.0, "blue", ZERO_VECTOR);
llDie();

}
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
03-08-2008 18:45
Probably it is running out of energy. You can't keep more than a small object (about avatar sized) afloat for very long using normal physical movement. You'll have to switch to vehicle functions, which ignore mass. Or non-physical movement maybe, but I'd try the vehicle functions first.
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
03-08-2008 20:14
Is llMakeExplosion still being used?
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
03-08-2008 22:04
yep it is still being used, and i highly dought it is running out of energy, the problem lies in the llSetTimerEvent() area id light to make it launch the second it spawns couse even .1 second delay is enought to get yourself shot out of the sky with your own rocket
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-09-2008 04:59
might also change the offset to be forward of the rezzor so it rezzes and stays in front, since you also have load time for the scripts in the rocket to be instanciated on the server
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -