Hi,
I built a weaponsystem for my game which checks for hits via line trace (just like in the shooter example). It works like a charm but I decided to add a bouncing effect yesterday. I want the trace to bounce off a wall and check there also for hits. I already achieved this, however I got a much more simple problem now: I can’t scale the magnitude of the ricocheted line whatsoever. I don’t want the bouncing ray to be the same size as the incoming ray but a bit smaller.
I thougth it was simple Math and I just needed to multiply the “BouncingVector” by 0.1 or something, but if I do this, it ends up chaning its direction as seen on the second screenshot. I always thougth multiplying a vector doesn’t affect its direction but just its magnitude?
non-changed BouncingVector (correct direction):
http://puu.sh/k9BV8/c2f3674f12.jpg
BouncingVector = BouncingVector*0.1 (changes direction):
http://puu.sh/k9BXo/84e7c040ea.jpg
Here is my code so far:
function where the problem lays:
http://puu.sh/k9C6S/d5ab02753c.png
calling the function:
http://puu.sh/k9C8u/e9c4b4e1a0.png
Can someone perhaps put me out of my misery?
Cheers
~Theo
P.S: I got a workout going, thanks to Ctzn07:
FRotator LookAtRot = UKismetMathLibrary::FindLookAtRotation(Hit.Location, BouncingVector);
FVector test = UKismetMathLibrary::GetForwardVector(LookAtRot) * 200 + Hit.Location;
But would still like to know why it’s changing the direction when multiplied like above. :o