Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dropping a non-physical object.

OnionRing Donaldo
Registered User
Join date: 26 Feb 2006
Posts: 11
07-05-2006 18:38
Ok so I have a 75-prim object here, and I'm dropping it from a hight of whatever the ground height is + 35 meters. I can get the object up there easily, but when dropping it, I'm using a succession of 4 seperate movement scripts done in succession with timers. I didn't write the entire script so I'm not quite sure how it works. When testing though, it does not work at all terrains, and sometimes it doesn't even drop. Sometimes it drops half-way, sometimes it's dropped with like 7 meters left. Only in one sim has it worked all the way. I have no idea why it's doing this. Any ideas?

Here's the script that controlls the 4 movement scripts:
CODE

// Non-Physical Flying Vehicle
// A.K.A: How to exploit tricks in LSL to get your way
//
// (your way being: up to 254 prims on a vehicle, in this case)
// Author: Jesrad Seraph
// Modify and redistribute freely, as long as your permit free modification and redistribution

integer hidden_face = 5;

float max_fwd = 2.0; // max speed in m per quarter of a second
integer max_rot = 4; // max turning speed in degrees per quarter of a second
float hover_height = 1; // prefered minimum height above ground

float fwd_accel = 0.015625; // forward/back acceleration
float up_accel = 0.015625; // vertical acceleration

float inertia = 0.75; // movement slowdown rate
float moment = 0.5; // turning slowdown rate

// internal stuff, don't modify
vector velocity;
vector veloff = <0.5, 0.5, 0.5>;
integer timeout;
integer number = 100;

stop()
{
llResetOtherScript("move");
llResetOtherScript("move1");
llResetOtherScript("move2");
llResetOtherScript("move3");
llSetColor(velocity + veloff, hidden_face);
timeout = 0;
//llSetTimerEvent(0.0);
velocity = <0.0, 0.0, -0.5>;
if (timeout == 0)
{
llMessageLinked(LINK_THIS, max_rot, "nonphy", (key)((string)max_fwd));
llSetTimerEvent(0.05);
}
timeout = 12;
}

default
{
state_entry()
{
stop();
}

on_rez(integer param)
{
llResetScript();
}

timer()
{
if (--timeout == 0)
{
llResetOtherScript("move");
llResetOtherScript("move1");
llResetOtherScript("move2");
llResetOtherScript("move3");
llSetTimerEvent(0.0);
return;
}

if (velocity.z > 0.0) velocity.z = 0.0;
velocity.z -= up_accel;
if (velocity.z < -0.5 ) velocity.z = -0.5;
if (llGetPos() * <0,0,1> < llGround(llGetPos()) + hover_height)
{
velocity.z = -0.25;
llMessageLinked(LINK_ALL_OTHERS, number, "", NULL_KEY);
number++;
}

if (llVecDist(llGetPos(), llGround(llGetPos()) * <0,0,1>) < 11.0)
{
velocity.z = -0.05;
}

if (llVecDist(llGetPos(), llGround(llGetPos()) * <0,0,1>) < 0.05)
{
velocity.z = 0;
}

llSetColor(velocity + veloff, hidden_face);
}
}


And here's the code for one of the movement scripts (they are all the same, just numbered differently)
CODE

integer hidden_face = 5;

float max_vel;
vector veloff = <-0.5, -0.5, -0.5>;

default
{
link_message(integer part, integer code, string msg, key id)
{
if (msg != "nonphy") return;
max_vel = (float)((string)id);
llSleep(0.05 * (integer)llGetSubString(llGetScriptName(), -1, -1));

while(TRUE)
{
llSetPos(max_vel * (llGetColor(hidden_face) + veloff) + llGetPos());
llSetPos(max_vel * (llGetColor(hidden_face) + veloff) + llGetPos());
llSetPos(max_vel * (llGetColor(hidden_face) + veloff) + llGetPos());
llSetPos(max_vel * (llGetColor(hidden_face) + veloff) + llGetPos());
llSetPos(max_vel * (llGetColor(hidden_face) + veloff) + llGetPos());
}
}
}
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
07-05-2006 21:21
in your controller script . . . where you call llGround (both times) you do it at 0,0,currentheight which might or might not be what you are looking for. Try removing the * <0,0,1> from those calls.

Just glanced at it but that's what I'd try first.
_____________________
Gaius Goodliffe
Dreamsmith
Join date: 15 Jan 2006
Posts: 116
07-05-2006 23:24
Is this an attempt to determine your altitude?
CODE
llVecDist(llGetPos(), llGround(llGetPos()) * <0,0,1>)

If so, it won't work (and is way more complicated than it needs to be, even if you did fix the errors in it). You probably want something like this:
CODE
vector loc = llGetPos();
float altitude = loc.z - llGround(ZERO_VECTOR);
OnionRing Donaldo
Registered User
Join date: 26 Feb 2006
Posts: 11
07-06-2006 10:17
Yeah none of those things worked :(
THe problem with your idea, gaius, is that I need the statement to be executed at the if statement itself, not before. As for the <0,0,1>, I use that to isolate the z vector.