Download

Shooting a sphere in raytrace direction not working

Hi everyone,

I’m having issues launching a sphere at certain pitch values. Here is my basic setup:

I have a thirdperson character blueprint with a sphere attached as a spawn point. I’m doing a linetrace from that spawn point and saving the hit actor and hit location. I am then spawning an actor (another sphere) and adding impulse to the actor in the direction of my linetrace.

This seems to work perfectly fine as long as my character is aiming high. But when I aim low the actor is shot at a wrong angle.

I tried inverting the Z value of the lookat rotation and it doesnt work. I tried inverting the z value of the forward vector and it also doesnt seem to work. I’ve used the camera rotation instead of lookat rotation, but nothing seems to work.

What’s more puzzling is that the raytrace location is working, as I’m using the hit location to spawn actors in the world.

Here is my linetrace blueprint:
73a2b5ecf9c29bab4657b4ecb2acb8e2904fb232.jpeg
Raytrace2.jpg

And here is my code for spawning and adding impulse to the sphere:
Fireball.jpg

Please take a look at this 2min video to see the issue - https://youtu.be/3OSx20RdaEI.

Notice how the ball shoots correctly as long as Im aiming high, but doesnt work when aiming low.

I really appreciate any help I can get on this.

Thanks,

-Jorge