I have an attachment that is used to push/pull users for a combat weapon. The object uses llPushObject from an attachment. For some reason or another, the script just loses all power and can no longer move anything. It can SLIGHTLY move things but the power is significantly decreased. Using llGetEnergy returns that the object has plenty of energy left.
Things I've tried:
Changing mass of attachment
Moving object to different attachment point.
Resetting the scripts.
Trying it on LIGHT objects/avatars.
Taking the object off and putting it back on.
Making the root prim bigger.
The only thing that gets it working again is to rez out a new object, put the scripts in, then attach it. Nothing above worked except for this. The object I have made has multiple links and is a lengthy process to remake it every time it randomly quits. Is there something I am doing wrong or what? ;(
sensor( integer i )
key id = llDetectedKey( 0 );
vector pos = llDetectedPos( 0 );
vector o_pos = llGetPos();
float mass = llGetObjectMass( id );
float dist = llVecDist( pos, o_pos );
float force = llPow( dist, 3.0 ) * push_force; // push_force = 150
vector local_pos = ( pos - o_pos ); // Convert global positions to local force. Target Pos - Current Pos
llPushObject( id, local_pos * force * mass, ZERO_VECTOR, FALSE );
Keep in mind, the code above is a shortly written example of my main code. This is to keep things simple.
EDIT: I've singled out the issue. This only happens when going to another sim from the one I first created the object in. I.E if I make it in some random sim of my choice, it will work flawlessly, but if I go to another one, it doesn't work at all. And if I go back to the sim before, it no longer works there either.