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):
BouncingVector = BouncingVector*0.1 (changes direction):
Here is my code so far:
function where the problem lays:
calling the function:
Can someone perhaps put me out of my misery?
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