Hello everyone, I’m trying to get a specific result from a collision using Vector3.Relfect() which does not seem to be its default behavior:
I’ve seen Vector3.Reflect(), but In my case, I’m simulating (sort of) a cannon shell impacting iron armor, so I’m looking for more of a reflection vector like in my image below (a much flatter angle, where the shell almost “slides” along the armor after it deflects).
If anyone could show me a way of doing this or what math concepts I would need to get the result I’m after, I would greatly appreciate it.
Well, you could simply reflect it and then subtract a fractional part of the projected vector along the surface normal (well that sounds more complicated than it is :D)
var reflected = Vector3.Reflect(incomingVelocity, normal);
var v = Vector3.Project(reflected, normal);
var result = reflected - v * 0.9f;
This would take away 90% from the distance of the reflected vector to the surface. So just imagine point R in your diagram goes straight downwards. If you use 1.0 instead of 0.9 the point R will be on the surface.
The second paramater need to be normalized.