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

I have searched before for this in ******. Searched even for formulas that could be used in pawn. But had no luck and found nothing. What I am trying to do is getting the relative position of an object depending on another one. Lets say, an object is created at OnGameModeInit. Then an admin creates another object near the first created object. After the second object is created it's coordinates and rotation are saved. After that is done, we change the coordinates and rotation of the first object that is created in OnGameModeInit. We compile it and launch the server. Then an admin creates the second object by writing the command, but now the second object would not be created where it was created during the first server run but relative to the first created object.

When it comes to more complex math equations I am lost. Any links to helpful articles would be appreciated.
Reply
#2

Doesn't even make sense what you are trying to do you have explained it very poorly.
Reply
#3

Quote:
Originally Posted by Pottus
View Post
Doesn't even make sense what you are trying to do you have explained it very poorly.
By trying to think of a better explanation I think I found an alternative to the complex math that is needed for what I am trying to achieve.

Just one question is there a limit to AttachObjectToObject?
Reply
#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


Forum Jump:


Users browsing this thread: 2 Guest(s)