How do I combine an up vector and a right vector direction?

I’ve been trying to make a bullet shell come out of my gun in a certain direction using impulses but I’m not sure how I would make it come out in a direction I would like, I tried combining the up and right vector of the shell to make it come out of the side of the gun but it didn’t really work out.

Shell9mm->AddImpulseAtLocation((GetActorUpVector() + GetActorRightVector() / 2.f) + 10.f, GetActorLocation());

I had no idea what I was doing with the math

// Impulse direction 
const FVector ImpulseDirection = (GetActorUpVector() + GetActorRightVector()).GetSafeNormal();

// Scale the impulse
const FVector Impulse = ImpulseDirection * 10.f;

// Apply the impulse at the actors location
Shell9mm->AddImpulseAtLocation(Impulse, GetActorLocation())
1 Like

this worked for me, thank you!

1 Like

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