# Calculating position and rotation based on two objects

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

## Recommended Posts

I am working on a symmetrical rezzer.  The base object rezzes prims around it in a circle.  The objects move with the rezzer when I move it, as per design.  I want to be able to move one of the rezzed objects and have the other objects move the same way, but in relation to their own rotation and that of the rezzer prim.  If I move the object closer to the rezzer, all objects should move closer to the rezzer.  If I rotate the object all other objects should rotate in kind but in relation to the rezzer so that all objects stay in a symmetrical pattern around the rezzer.

I have tried getting the offset of the distance between the moved object and the rezzer, then applying that to the other objects vs the rezzer object position, then applying each object's rotation and that of the moved object.  Every combination I've tried fails to get the desired results.

The moved object's position and rotation are key, so is the rezzer prim's position and rotation.  Combining the two and applying them to every other object to mimic the moved object in a mirror fashion is what I'm looking to do, but I can't find anything anywhere to give me an idea how to do it.

##### Share on other sites

This is an interesting challenge.

The way I'd approach it is to have the rezzer keep checking on the positions and rotations of all the items it has rezzed and, if anything has moved, calculate the new offset and rotation, derez the old objects and then rez a new set in the new positions.

How would that work for your purposes?

##### Share on other sites

That wouldn't work for what I am trying to do.
I've almost got it licked, I can move my master prim (not the rezzer) and the other prims move in kind, but when I do a rotation the other prims get off by a bit, especially if I send an updated pos/rot when my master prim is at an angle and not straight with an axis.  It goes very wrong from there, but I'm close to getting it.

##### Share on other sites

**UPDATE** After much struggle with my current method (namely the second snippet above), there's no way to make it work because you're trying to combine data from multiple sources and make a position and rotation.  It works if you are using the right rotation to begin with, but start moving prims around and the rotations get all out of whack.  The solution is to restrict rotation based on the rezzer and use positional offsets while keeping rotation of the rezzed prims intact.