Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Hovering on objects

Kezz Mauriac
Registered User
Join date: 27 Sep 2005
Posts: 19
01-03-2007 11:56
Is there any way to get a vehicle or other object to hover over prims as well as land and water? Forgive me if this is an exceedingly stupid question.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
01-03-2007 14:26
Maybe try a narrow sensor pointed straight down, and pick up the first object it sees? I think the sensed object list is sorted by distance. Or I guess you could walk the list and figure out which one is closest.

I've seen some birds that fly around and appear to randomly land on objects. I couldn't find anything special about the objects the birds landed on, but it's possible that was just visual effects, and the birds had pre-programmed coordinates. Or, they were doing something like what you're trying to do. Either way, it was pretty impressive :)
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
01-03-2007 14:29
From: Ziggy Puff
Maybe try a narrow sensor pointed straight down, and pick up the first object it sees? I think the sensed object list is sorted by distance. Or I guess you could walk the list and figure out which one is closest.

I've seen some birds that fly around and appear to randomly land on objects. I couldn't find anything special about the objects the birds landed on, but it's possible that was just visual effects, and the birds had pre-programmed coordinates. Or, they were doing something like what you're trying to do. Either way, it was pretty impressive :)



I've mad similar flying "pets" they have set landing points that are either note-carded or hard-coded into the animals.

your suggestion of a narrow sensor pointing straight down is a good one, although you'd have to take into account the bounding box of what it's hovering over since coordinates returned from llDetectedPos(...) show the center of the object (Based on the root prim I believe)
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
01-03-2007 14:42
Yeah. There's no llDetectedScale or llDetectedBoundingBox, unfortunately. So I guess this would have limited use, where you had some idea of what kind of "prim terrain" you were over.

Maybe the birds I saw were yours :)
Peekay Semyorka
Registered User
Join date: 18 Nov 2006
Posts: 337
01-03-2007 14:53
llGetBoundingBox takes a key, so can easily be used with a sensor.

-peekay
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
01-03-2007 15:24
Hmm... now I'm getting crazy ideas about a 3D maze traversing bot :)
Kezz Mauriac
Registered User
Join date: 27 Sep 2005
Posts: 19
01-04-2007 06:45
Peekay, could you elaborate a slight bit more on using that function? What kind of key do I have to use? Forgive me but I am not a scripter.
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
01-04-2007 13:10
From: Kezz Mauriac
Peekay, could you elaborate a slight bit more on using that function? What kind of key do I have to use? Forgive me but I am not a scripter.


I'd tackle this with a 2nd script from your main that looks something like the following, pushing the vehicle upwards based on how far away from. keep in mind that Sensor sweeps are relative to the prim's orientation, so this would mean the prim it's in has it's Z axis facing directly down relative to the vehicle:


CODE


default
{
state_entry()
{
llSensorRepeat("",NULL_KEY,PASSIVE,5,0.1,1);
}

sensor(integer num)
{
vector primtop=llDetectedPos(0)+llList2Vector(llGetBoundingBox(llDetectedKey(0)),1);
vector mypos=llGetPos();

llApplyImpulse(<0,0,llGetMass()/(mypos.z - primtop.z)>,FALSE);
}
}


This was not tested in world, so I can't garauntee it will run/compile, but the general idea is that the sensor event calculates the Z value for the top of the prim and then applies an impulse upward based on the vehicle's mass and distance from the prim (Definately need some field testing for the strength of the impulse). in theory this should keep the vehicle up from any prims that are beneath it. I have the sensor set to 5m so that's the approximate hover height that should be used in the vehicle flags.
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.