How would I rotate an object so that it’s forward vector is pointing to the end of a line trace?
That didn’t seem to work. But not because of the blueprint but because the line trace is not hitting anything. Walls, floors, enemies, nothing. This has something to do with the Trace Channel. I created trace channels called “Targeting” and “Projectile”. Targeting for the guns and projectile for the grenade launcher whose direction I want to control. The guns produce a hit regardless of the trace channel. The projectiles do not produce hits on any channel. It’s worth mentioning all the object in the scene have their collisions set to block. How so I fix this?
It sounds as though you need to confirm the settings of your collisions:
- The default response of your ‘Projectile’ channel; for simplicity, this shouldn’t be set to ‘Ignore’
- The collision response of the object you’re trying to land a trace on; likewise, this shouldn’t be ‘Ignore’
- Whether you’re using a Line Trace or Multi Line Trace; if you’re using Multi Line, the logic is counter intuitive. See the following post:
Multi Line Trace Confusion - Programming & Scripting / Blueprint - Epic Developer Community Forums
Thanks for getting back to me so quick. I was just about to edit my post. I figured it out. I had a different line length for different weapons based on range. The projectile ones had a much shorter trace and was not registering. What I am trying to do is have a projectile fire directly away from the player and not from where the barrel is pointing. I have a scene object pointing away from the barrel and the impulse of the spawned projectile is currently shooting it in the direction of the barrel. I thought by rotating the projectile to the direction of the player using a trace before adding the impulse would work but it doesn’t. Any thoughts on how to make this happen?
OK, I got it to work. The above solution was working. The problem was I was placing it on the projectile parent so any children would rotate when it spawned. When the item was spawned it was at the barrel’s transform and then rotating after the impulse fired leaving it on the trajectory of the barrel. I just had to put it going into the SpawnActor from Class node. The only thing left is that the projectile is exploding right in front of me but I think that’s an issue with the projectile colliding with the player’s capsule collider.
I would need to see what you mean by:
But, if this is a shooter concept, youtube has many, many tutorials on first- and third-person shooter games.
Finally! I got it to work. This projectile problem has been one I’ve been putting off for months. It was just randomly firing in all directions. Thanks for your help.
You’re welcome. Cheers.




