Hi, I am trying to get a position of a point relevant to another position with a different axis system and I can’t make it work.
This is what I try to achieve: If the position of the block (let’s call it customAxisSystemOrigin
) equals Vector3.new(1,2,3)
and the orientation of the axis system (let’s call it customAxisSystemRotation
) equals Vector3.new(0,0,0)
, and the offset/point in the axis system (let’s call it offset
) equals Vector3.new(20,20,20)
, then the final point in the world space will be Vector3.new(21,22,23)
.
What I need is the way to calculate inWorldPoint
using customAxisSystemOrigin
,
customAxisSystemRotation
and offset
.
-
customAxisSystemOrigin
is aVector3
that represents the0,0,0
point within the custom axis system -
customAxisSystemRotation
is aVector3
that represents the normal of the custom axis system -
offset
is aVector3
that represent a certain point on the custom axis system -
inWorldPoint
is aVector3
that represents the translation ofoffset
from object space (a point in the custom axis system) to world space (a point in the default axis system)
The way I get these variables is using a raycast. I send a ray from position RayOrigin
to direction RayDirection
that hits at position RayHitPosition
at distance RayHitDistance
.
I would really appreciate if someone can send me an algorithm or a function that uses these variables to calculate the result inWorldPoint
.
Also if any other information like more variables or explanation about something from the above, feel free to ask.