Home Unreal Engine

First person shooter template not aiming straight

polycounter lvl 6
Offline / Send Message
BTDarmstad polycounter lvl 6
I'm currently following a tutorial for making a little shooting gallery, and I felt like adding some stuff for practice. I'm just using the first person shooter template for this one, and I made some modifications to the projectile so it moves faster, disappears on impact, triggers a particle effect, and is not affected by gravity, as in moving straight forward. However, I noticed that the projectile doesn't really hit where the cross-hair points in the middle of the screen. I'm guessing the projectile doesn't actually have a trajectory based on what I'm aiming at.

Is there an easy way to fix the trajectory so that the projectile hits what I'm aiming at?

Replies

  • Zack Maxwell
    Options
    Offline / Send Message
    Zack Maxwell interpolator
    The template, unfortunately, doesn't even try to aim straight. I can't recall if it even uses a crosshair.
    The best way I've found to get the bullet to fire at the crosshair is to perform a line trace from the camera location, in the camera direction. I think you can use something like Get Control Rotation to find that.
    Once you have the hit location from the line trace, get the vector direction between the projectile's launch location and that hit location, and set that as the vector direction for the projectile.
    This will launch the projectile toward the surface the crosshair is aiming at.
Sign In or Register to comment.