Rotate 3D point around another 3D Point

1k Views Asked by At

yes, i have been searching other posts on stackoverflow, but mostly i don't understand them or i don't know how to implement it in my scripting language.

I want to rotate a 3D point around another 3D point, i have a parent 3D point with 3D rotation and child 3D points with 3D rotation, how can i rotate the child points around the parent point keeping the rotation informations?

Scripting language is PAWN, but C language is also fine(Because it's similar), i know i have to use those functions:

  • floatcos(Float:angle, anglemode(radian, degrees or grades));
  • floatsin(Float:angle, anglemode(radian, degrees or grades));
  • floattan(Float:angle, anglemode(radian, degrees or grades));

Parent point and Child points have those coords: X(Left Right), Y(Front Back), Z(This is Up and Down) RX(Rotation Pitch), RY(Rotation Roll), RZ(Rotation Yaw)

Red is the Parent Point Blue are the child points

Click here for Image

I hope you guys can help me, i'm really bad at math and i need this to work somehow :/

1

There are 1 best solutions below

1
On BEST ANSWER

Well i did it using a Rotation Matrix library, it calculates the world position from all attached objects from the parents position and rotation.

A user from a math forum suggested this and it works https://en.m.wikipedia.org/wiki/Rotation_matrix