Confused about rotation / local space

Hello, Im a bit confused on how I get local space on a hit surface. What ive done, MakeRotationFromX at the impact normal, Get the forward/right./up vec and make a debug line on those vectors. But whenever I rotate the object, hit it from above or the side. Those debug lines dont follow the surface anymore at the correct rotation.

Im not very good at math, And im pretty sure I need to use sin/cos But I dont know where to start.

Debugline: Any help to point me in the right direction would be much appreciated.

So you want the new trace to be the normal at the impact point?

I want the lines to folow the face its surface that was hit. But as show in the picture when I hit the box collison from the side when its rotated, The up and right doesnt match up anymore. The results gets worse when the box collision is rotated along multiple axis.

So do a trace from the (impact point) to ( impact normal * length). That will do it.

Im sorry but I dont get it. impact point + (impact normal * length). Results into a single line pointing outwards, The same wich I got with MakeRotFromX → Get forward Vector.

Sorry, misunderstood your question…

So you don’t need the normal, you need the normal rotated through 90 ( to touch the surface ), and then rotated by the angle of your original hit.

I’m thinking…

Yes, I get you. I’m about 1/2 way, but haven’t figured out the rest. Does it have to fit on the face, or do you just want a vector lying on the face? ( can extend off the object? )

basically what im trying to achieve is to figure out how much length I need on the face upwards/sidewards from the impact point to reach the face its edges, respectively to the face its orientation.

It may extend off, I think that wouldn’t be a problem to get the edge its cord.

Ok got it, apart from the detecting the edge of the mesh, you’ve got your work cut out there…

324483-ezgifcom-optimize.gif

May not be the best way, but it works. Tell me if you don’t get it.

( I’m showing the normal at the impact point rather than the trace going in, but the second arrow is what you’re looking for… )

Better pic. Line trace on first half, big arrow showing the ricochet:

324484-ezgifcom-optimize1.gif