Jump to content

Move link in physical linkset


Patrick Playfair
 Share

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

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

Recommended Posts

I have a problem that I cannot resolve.  I have a UFO, and beneath it a tractor beam.  It is used to abduct people by seating them on the prim and animating them using a combination of experience tools and RLV.  I can also release them or Teleport them.   It works fine, but with the beam hanging under the ship, I cannot land and it collides with things.  I have a switch to make it alpha, but it still collides with everything.  My hope was to either move it up, or shrink it.   llSetPos(llGetPos() + <0,0,1>); works with a single prim, but not when I link it to the linkset.  I have also tried   llSetLinkPrimitiveParamsFast(PrimNo,[PRIM_POSITION,(primPos + <1,0,0>*primRot)/llGetRootRotation()])  with the same results, works with a single prim , but not when linked to anything.  I then heard about using PRIM_PHYSICS_SHAPE_TYPE ]  to make the prim type NONE.  When I attempt to start the UFO, it tries to change the whole linkset to physical and returns an error "Can't enable physics for object with physics resource cost greater than 32" and I do not know what that error means.  If I change the type to NONE after it has started, it works, until I seat someone on the prim, or unseat them, then I have to shut it down, change it back to PRIM, start it again, and change it back to NONE again.

Anyone have any thoughts on how to accomplish this?

Link to comment
Share on other sites

;)  Good luck.  The easiest way to approach that probably is the make a short list with two vectors in it, one for the local UP position of your beam and one for the DOWN position.  Then use a toggle to switch between them as needed:

//Assuming that giBeamPos is your toggle and glPositions is your list ...

//SetLinkPrimitiveParamsFast(Beam-Link,[PRIM_POS_LOCAL,llList2Vector(glPositions,giBeamPos)]);

Then just switch giBeamPos from TRUE to FALSE when you want to raise or lower the beam.

Link to comment
Share on other sites

33 minutes ago, Rolig Loon said:

;)  Good luck.  The easiest way to approach that probably is the make a short list with two vectors in it, one for the local UP position of your beam and one for the DOWN position.  Then use a toggle to switch between them as needed:

//Assuming that giBeamPos is your toggle and glPositions is your list ...

//SetLinkPrimitiveParamsFast(Beam-Link,[PRIM_POS_LOCAL,llList2Vector(glPositions,giBeamPos)]);

Then just switch giBeamPos from TRUE to FALSE when you want to raise or lower the beam.

Thanks... I think I got it!

 

Edited by Patrick Playfair
Link to comment
Share on other sites

It will move the whole object if the link you are moving is the root prim.  If you onl;y want to move that one prim, but sure that it's a child prim.  Otherwise, you have to move the root first and then move every other blasted prim back.

And no, it won't work if you try it on a physical object.  You can't use llSetPos, llSetRot, or any of their look-alike functions on physical objects.  The trick there is to switch physics off and then back on again after you've finished moving things.  It's a pain, but doable.

Edited by Rolig Loon
Link to comment
Share on other sites

Can't you simply make the beam phantom?  

Or, if it's a mesh beam, set it to [PRIM_PHYSICS_SHAPE_TYPE,PRIM_PHYSICS_NONE] with llSetLinkPPFast? (I'm not sure if the two aren't equivalent but it can't hurt to do both).

ETA: I see you've tried setting the PRIM_PHYSICS_SHAPE_TYPE -- I don't completely understand the error you're getting there, but I suspect you're building with prims and then simply leaving everything but the beam at PRIM_PHYSICS_SHAPE_PRIM.   You need to try first setting the whole thing to Convex Hull, if that's the case, and then possibly set more stuff to PRIM_PHYSICS_SHAPE_NONE when the space ship is moving.   Then just the root and stuff you need to stand on need to be be CONVEX_HULL.

Edited by Innula Zenovka
Link to comment
Share on other sites

27 minutes ago, Rolig Loon said:

It will move the whole object if the link you are moving is the root prim.  If you onl;y want to move that one prim, but sure that it's a child prim.  Otherwise, you have to move the root first and then move every other blasted prim back.

And no, it won't work if you try it on a physical object.  You can't use llSetPos, llSetRot, or any of their look-alike functions on physical objects.  The trick there is to switch physics off and then back on again after you've finished moving things.  It's a pain, but doable.

Thanks a lot... it appears to be working fine, even when physical.  It's not moving where I want it yet, but it is moving.  Here is what I have, it's not pretty and needs some cleaning up.

            if (str == "Beam On")
                {
                    llSetAlpha(1,ALL_SIDES);
                    float i;
                    for(i = 0.0; i < glow; i += 0.0025 )
                    {
                    llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, i , PRIM_POINT_LIGHT, TRUE, color , light, radius, falloff]);
                           if (llGetNumberOfPrims() > 1 && PrimNo != 1)
                            {
                            list primP = llGetLinkPrimitiveParams(3, [PRIM_POSITION,PRIM_ROTATION]);
                            vector primPos = llList2Vector( primP, 0 )-llGetPos();
                            rotation primRot = llList2Rot( primP, 1 );
                            llSetLinkPrimitiveParamsFast(3,[PRIM_POS_LOCAL,(primPos + <-1,0,0>*primRot)/llGetRootRotation()]);
                            }                             
                    }
                    llResetScript();
                }
               
            if (str == "Beam Off")
                {
                    llSetAlpha(0,ALL_SIDES);
                    llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0 , PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR , 0.0, 0.0, 0.0]);
                           if (llGetNumberOfPrims() > 1 && PrimNo != 1)
                            {
                            list primP = llGetLinkPrimitiveParams( 3, [PRIM_POSITION,PRIM_ROTATION]);
                            vector primPos = llList2Vector( primP, 0 )-llGetPos();
                            rotation primRot = llList2Rot( primP, 1 );
                            llSetLinkPrimitiveParamsFast(3,[PRIM_POS_LOCAL,(primPos + <1,0,0>*primRot)/llGetRootRotation()]);
                            }            
                   
                    llResetScript();
                }

Link to comment
Share on other sites

7 hours ago, Patrick Playfair said:

list primP = llGetLinkPrimitiveParams(3, [PRIM_POSITION,PRIM_ROTATION]);
                            vector primPos = llList2Vector( primP, 0 )-llGetPos();
                            rotation primRot = llList2Rot( primP, 1 );
                            llSetLinkPrimitiveParamsFast(3,[PRIM_POS_LOCAL,(primPos + <-1,0,0>*primRot)/llGetRootRotation()]);

You're still writing your local position adjustment as if it were a regional change.  The exercise is simply to move the child prim relative to the root, so if you want to do things that way you are, use llGetLinkPrimitiveParams to grab PRIM_POS_LOCAL and don't go through all the business of calculating it from regional values.  Then apply itthe same way:
 


list primP = llGetLinkPrimitiveParams(3,[PRIM_POS_LOCAL]);
vector primPos = llList2Vector(primP,0);
llSetLinkPrimitiveParamsFast(3,[PRIM_POS_LOCAL,primPos + <-1,0,0>]);

Or, take the easy way out and hard code the values into your script, as I suggested earlier.  Since you are only dealing with two positions, that will save you having to calculate positions and rotations every time you move the prim.  So create a global list:

list primP = [ <measured DOWN position vector here>,<measured UPposition vector here>)];

and a global integer that you can use as a switch:

integer IsUp;   //= TRUE if prim is UP; FALSE if prim is DOWN

Then when you want to move the child prim from the UP position to the DOWN position or vice versa, you just call the values directly from that list:

llSetLinkPrimitiveParamsFast(3,[PRIM_POS_LOCAL,llList2Vector(primP, IsUP)]);

 

Edited by Rolig Loon
typo
  • Like 2
Link to comment
Share on other sites

Quote

Can't enable physics for object with physics resource cost greater than 32

...this is a limit to physical linked objects for vehicles, but you can have more than 32 if you make all

but the root Phys shape NONE. ( as Innula suggested)

  llSetLinkPrimitiveParamsFast(LINK_ALL_CHILDREN, [PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_NONE]);

if your beam seat has a sit target, you should still be able to sit on it even if it is ..type- NONE?

Edited by Xiija
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1949 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...