Jump to content

Script stops working after linking


ColeJohnsenn
 Share

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

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

Recommended Posts

Hello togehter !

im trying to make an object that is surrounded by other small floating (hovering) objects. I used this script for the small objects.

default {
state_entry() {
integer p = 0;
for (; p < 15; ++p) {
llSetPos(llGetPos() + <0,0,0.025>);
}
state floatdown;
}
}

state floatdown {
state_entry() {
integer p=0;
for (; p < 15; ++p) {
llSetPos(llGetPos() - <0,0,0.025>);
}
state default;
}
}

 

It works fine but as soon as i link the small object with the big middle on (the root one that shouldnt float) all of them stop floating !

Can someone please help me?

Link to comment
Share on other sites

Read the description of llGetPos and llSetPos in the wiki. What you see?

llGetPos will return the region coordinates

llSetPos expects the region coordinates if the script is in an unlinked prim or root.
If in a child prim it expects the local coordinates. (relative to the root prim)

Since you try to use the region coordinates that will be far over the 10m limit and nothing happens.

What can you do? There are alot of different solutions. For example you can calculate the local coordinates:

   llSetPos( llGetPos() - llGetRootPosition() + <0,0,0.025>);

or less clumsy:

   llSetPos( llGetLocalPos() + <0,0,0.025>);

Your script doesnt care for rotations, that's probably the next addon.

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...