math problem with portals (velocity & directions)
I making a portalgun mod, almost everyting is done, but still have to calculate the velocity manipulation.
*Remade declaration*
like if
portal 1 yaw = math.pi * 0
portal 2 yaw = math.pi * 1.5
object.velocity.x=-4
after teleporting the object.velocity.x=-4 should be object.velocity.z=4
== or if ==
portal 1 pitch = math.pi * 0
portal 2 yaw = math.pi * 0.5
object.velocity.y=-4
after teleporting the object.velocity.y=-4 should be object.velocity.z=-4
Someone that can mathematical way to calculate it?
Here is an illustation:

*Remade declaration*
like if
portal 1 yaw = math.pi * 0
portal 2 yaw = math.pi * 1.5
object.velocity.x=-4
after teleporting the object.velocity.x=-4 should be object.velocity.z=4
== or if ==
portal 1 pitch = math.pi * 0
portal 2 yaw = math.pi * 0.5
object.velocity.y=-4
after teleporting the object.velocity.y=-4 should be object.velocity.z=-4
Someone that can mathematical way to calculate it?
Here is an illustation: