Jump to content
firefox22771

llPushObject power loss at random.

Recommended Posts

Hello there!

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.
  • Relogging
  • Changing sims.
  • Taking the object off and putting it back on.
  • Making the root prim bigger.
  • Enable.disable phantom.

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? ;(

 

Code Snippet:

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.

Edited by firefox22771

Share this post


Link to post
Share on other sites

I have found out the problem! To those who are suffering from my same issue, here's how to fix it!

 

First off, it seems LL push is based off of object mass. This mass determines how much force the object can apply onto the target.

The bigger the object, the more potential for mass. The mass can also be changed in the Features tab in your edit menu. The mass option is called "Density"

You can find a median between size and mass by fiddling with both.

WARNING: it seems the calculations for how much force potential the object has is only reassessed after one has left the current sim to go to another one. It seems to only update the force calculation on sim change. The scripts do NOT need to be reset upon sim change.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...