Jump to content

How 2 llRezObject w/ object local pos w/ attached Object?


Eliwood407
 Share

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

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

Recommended Posts

___________________________________________________________
EDIT: Thanks to those who replied to this topic and contacted me in-game!
Sady it turns out it is not do-able the way I intended it to be.

For those who found this page on google and try to find the answer I was looking for:
-Sadly since animations are client-sided, and llRezObject is server sided, there is no way to have ATTACHED objects determine the local position of the object you are rezzing. It will work when the object is not attached, but the moment you have it attached the positions and rotations move into your avatar center.

The solution I use, although not as pretty:
-I have the sword make the Avatar perform an animation during the time the object needs to be rezzed.
I manually edited the llRezObject position and rotation (which is at <0,0,0> in the avatar center) to somewhat the correct location on the sword.

___________________________________________________________

Hello there!

My apologies if this thread seems a bit confusing, I try to explain it as best as I can.
(screenshot added at the bottom for reference)

Project:
A sword that is based on an exactoknife.
When segments get dull, those dull segments break off and the sword regenerates itself.
An object that looks like the dull segments get rezzed on the sword, and while that section of the sword turns invisible, the rezzed segment drops to the ground. (1 on screenshot)

Problem at hand:
-The dull segments that break off gets rezzed in the Avatar's chest, as if position/rotation is reset- (2 on screenshot)
Everything seemed to work just fine when the sword is rezzed on the ground.
But the problem started when I attached the sword on my avatar.

 

Thread's question:
Is it possible to -When sword is attached- make the broken sword blade (2) rez on the correct location (1)?
I have tried many things from using llGetLocalPos etc, but nothing seemed to work.
If it's possible, could some one steer me in the right direction?
Some one pointed out it depends on the way you retrieve the sword's info, again no luck.

 

Other info:
-Making the root prim rez the object.
-Tried many different things, from llRezAtRoot, to llRezObject. From llGetPos, to llGetLocalPost, to llGetObjectDetails.
-Piece of code I tried, for those who like to see. Keep in mind it's messy, I just needed to make it work before I clean it up.

rezbroken(){
vector relativePosOffset = <-1.579, -0.008, 0.0>; // "Forward" and a little "above" this prim
vector rezVel = <0.0, 0.0, 0.0>; // Traveling in this prim's "forward" direction at 1m/s
rotation relativeRot = <0.707107, 0.0, 0.0, 0.707107>; // Rotated 90 degrees on the x-axis compared to this prim

        key  id      = llGetLinkKey(1);
        list details = llGetObjectDetails(id, ([
                            OBJECT_POS, OBJECT_ROT]));
 
        vector myPos = llList2Vector(details, 0)+relativePosOffset;
        rotation myRot = llList2Rot(details, 1)+relativeRot;
 
        llRezObject("DamagedAvaliBlade", myPos, rezVel, myRot, 10);
}

 -Another piece of code I tried when I tried doing it differently.

rezbroken(){
vector relativePosOffset = <-1.579, -0.008, 0.0>; // "Forward" and a little "above" this prim
vector relativeVel = <0.0, 0.0, 0.0>; // Traveling in this prim's "forward" direction at 1m/s
rotation relativeRot = <0.707107, 0.0, 0.0, 0.707107>; // Rotated 90 degrees on the x-axis compared to this prim

        vector myPos = llGetPos();
        rotation myRot = llGetRot();
 
        vector rezPos = myPos+relativePosOffset*myRot;
        vector rezVel = relativeVel*myRot;
        rotation rezRot = relativeRot*myRot;
 
        llRezObject("DamagedAvaliBlade", rezPos, rezVel, rezRot, 10);
}

 

 

Reference picture of what it looks like, where the segment is supposed to Rez (1), and where it goes wrong (2).
temp2353.png

Link to comment
Share on other sites

The best you are going to be able to do is request the PRIM_POSITION/PRIM_ROTATION of the link you are replacing. 

 

list l = llGetLinkPrimitiveParams(LINK_NUMBER_BEING_REPLACED,[PRIM_POSITION,PRIM_ROTATION]);
vector p = llList2Vector(l,0);
rotation r = llList2Rot(l,1);
llRezObject("Object",p,ZERO_VECTOR,r,0);

It will be better than rezzing in your chest,  but it will never look 'right' because the information avalible to lsl is Animation Agnostic. 

  • Like 1
Link to comment
Share on other sites

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