Jump to content

Hover Object Attached on the Avatar


MarianoGT
 Share

You are about to reply to a thread that has been inactive for 2853 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello Master Scripters,

I have just starting researching about how to make an object hover up and down when attached to the avatar without affecting the avatar it self.

I have tried some free full perms scripts but they started moving my avatar up and down, instead of just the object.

Then I found this one that works fine when the object is on ground, but when I get it attached it doesn't moves at all...

-----

float meters = 0.005; // Range of hover movement in meters.
float delay = 0.1; // Delay in seconds between movements.
integer steps = 2; // Higher steps mean smoother and slower movement but more server load.
integer nstep=0; // Used to increment our steps.
float upDown = 1.0; // Keeps track of up and down state


default
{
state_entry()
{
llSetTimerEvent(delay); //use the timer to time events, not llSleep!
}
timer()
{
llSetPos(llGetPos()+<0,0,meters*upDown>);
if ((nstep+=1)>steps) //count the steps up or down
{
nstep=0;
upDown = -upDown;
}
}
}

----

This script is for personal use, its something I always wanted to do on a little toy I made for my self. I don't know much about scripting, I would say I'm level (0.1) on a scale of (1.000.000), if anyone can help me do its 2 Step up and down while attached to my avatar I will love it !!!

 

Thanks in advance,

Marian

Link to comment
Share on other sites

And this is the script that makes my avatar move when the object moves when attached.

---

float d=0.25//radius / distance we bob up and down
float step 0.2// distance to move each step.  0.1 would make it bob slow, 0.8 would make it bob faster, ect
vector pos;
float x=0;
vector bobthrust;

default
{
state_entry()
{
llSetBuoyancy(1.0); // this turns on buoyancy
llSetTimerEvent(0.5); // this sets the timer, the timer makes up bob up and down.
llTargetOmega(<0,0,0.5>,1,1);  // this part makes it spin (uses targetomega so it's client-side)
pos=llGetPos(); // cache our position (note that this will need to be done again if you move it)
llSetStatus(STATUS_PHANTOM TRUE); // become phantom
llSetStatus(STATUS_PHYSICS TRUE); // become physical (for smooth bobbing motion)
}

timer() // this part bobs up and down
{
x+=step// add our step in
bobthrust = <0,0,llCos(x)*d>; // use cosine to figure new position
llMoveToTarget(pos+bobthrust,0.8); // move to that new position
}

---

Unfortunately the first script I posted makes it rotate while attached, instead of moving up and down.

Link to comment
Share on other sites

When I use llSetLocalPos and then llGetLocalPos on the same line it says there is an error "Name not defined within scope"

It fixes that the object will stay where I set it and will not try to stay 5 meters above my head. Althought its still not moving up and down, its just static.

They both have to be on the same line ?

Its static now. =C

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2853 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...