No announcement yet.

Shooting a sphere in raytrace direction not working

  • Filter
  • Time
  • Show
Clear All
new posts

    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:
    Click image for larger version

Name:	Raytrace1.jpg
Views:	1
Size:	253.4 KB
ID:	1195682
    Click image for larger version

Name:	Raytrace2.jpg
Views:	1
Size:	266.0 KB
ID:	1195683

    And here is my code for spawning and adding impulse to the sphere:
    Click image for larger version

Name:	Fireball.jpg
Views:	1
Size:	305.3 KB
ID:	1195684

    Please take a look at this 2min video to see the issue -

    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.


    [WIP] Procedural City Generator | RPG AI
    [MARKETPLACE] Animal Behavior Kit | Space Shooter Template | Procedural Foliage Tool | Procedural Park
    [FREE] Modular Road Tool | Action Platformer Template | Radar BP | Free Birds | Procedural Buildings
    Join our Discord