Jump to content

Need help rezzing objects relative to root object...


Bruce Bonham
 Share

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

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

Recommended Posts

Hello! Thanks for trying to help.

I'm making one of those card-matching Memory games, and I'm currently working on having the game manager rezzing the shuffled cards. 

It works perfectly with the root object oriented the way it was when I programmed it. In that situation I just do this:

            for(i = 0; i < llGetListLength(newList); ++i)
            {
                if((counter > 0) && (counter%4) == 0)
                {
                    xPos += xIncrement;
                    zPos = 1.0;
                }
                else
                    zPos += zIncrement;
                
                llRezObject(llList2String(newList, i), llGetPos() + <0.0, xPos, zPos>,  <0.0,0.0,0.0>, <0.0,0.0,0.0,1.0>, 0);
                counter++;
            }

 

And it gives me a beautiful 4x4 grid of cards. 

Properly Aligned Rezzing

However, when I rotate the game manager object to a new orientation, then the cards are rezzing in the same location they were based on the earlier coordinates:

Improperly Aligned Rezzing

I bumbled about with getrot, getlocalrot, getlocalpos, but can't get anything to work. Primarily, because I believe that when you rotate then xPos+= xIncrement won't function... if you turn it around the opposite direction then it should probably have to be xPos-=xIncrement. At least that's what I think the ultimate problem is.

My question to you guys is can you help me find a solution that will allow my users to rotate the game board, or will I simply need to distribute it as uneditable and force them to only use the stock orientation?

Thanks again for reading, any and all suggestions and help would be appreciated. 

 

 

Link to comment
Share on other sites


Bruce Bonham wrote:

My question to you guys is can you help me find a solution that will allow my users to rotate the game board, or will I simply need to distribute it as uneditable and force them to only use the stock orientation?

Sure, you're adding an offset to the current position.... just multiply that offset by the current rotation, like so:

    llRezObject(..., llGetPos() + <xOffset, yOffset, zOffset> * llGetRot(), ...);

You probably also want to pass the result of llGetRot() for the new rotation as well.

Link to comment
Share on other sites

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