Complex math to get and set object relative coordinates and rotation
#4

What you said made absolutely no sense, but now that you mentioned AttachObjectToObject I think I understand. However, AttachObjectToObject isn't what you want.

So what your saying is basically that if you have a node and a bunch of objects relative to it, how can you rotate/move that node and all of the relative objects accordingly?

Well, I could explain how in depth but if you want to look in Texture Studio's code to see how Pottus and I do it feel free.

Have a look at these group commands: https://github.com/Pottus/Texture-St...wn#L1224-L1593

As you can see, moving along any axis (as done in commands gox, goy, and goz) is basically just addition and subtraction... rotation (as done in commands grx, gry, and grz) get's a bit more complex.



For the sake of this explanation, let's say we have three objects. For simplicity, let's say one of those objects is a basketball located at the exact center of the map (0.0, 0.0, 0.0). The other two objects are walls opposite from each other. One wall is at (5.0, 0.0, 0.0) and the other is at (-5.0, 0.0, 0.0). The basketball will be our node.

For movement, let's say you wanted to move the node up 1 unit. Then just do that and do it to the walls too.

For rotation, let's rotate the objects 90 degree around the Z axis. First retrieve the position of the node, (0.0, 0.0, 1.0). Then do everything in this function and set the object to the retrieved data.
Reply


Messages In This Thread
Complex math to get and set object relative coordinates and rotation - by Unte99 - 06.08.2016, 19:37
Re: Complex math to get and set object relative coordinates and rotation - by Pottus - 06.08.2016, 19:56
Re: Complex math to get and set object relative coordinates and rotation - by Unte99 - 06.08.2016, 20:20
Re: Complex math to get and set object relative coordinates and rotation - by Crayder - 07.08.2016, 05:01

Forum Jump:


Users browsing this thread: 1 Guest(s)