Positioning sprite relative to another at an angle

So currently Im working on the portal project I’ve tried a lot of things but can’t seem to get it correct

In the project when the sprite hits a portal, it puts that sprite where the other portal is and adds the offsetted position, this works perfectly

But if the portals aren’t parallel (ex: one is facing up and the other is facing right) then it does the exact same thing putting the sprite offsetted without accounting for the rotation of the exit portal

I don’t really know how to do this but it will likely involve trigonometry

TLDR:

I need a way to offset a sprites position relative to its location (not the best tldr for this situation)

untitled script pic (13)
not perfect, but the errors are pretty small most being within ±0.000000001 of what it should be

hope this helps!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.