How can I put bullets into LineTraceByChannel?

Hello! I have made a system that shoots bullets thanks to LineTraceByChannel. My only wish is to make it have actual bullets (as to this point I only figured out how to make look like it shoots), how can I accomplish this without breaking the logic of the script?

1 Like

You’ll want to replace your line trace with “Spawn projectile at location” and plug in the socket location to the spawn location.
You’ll have to look up out how to set up projectiles, but it’s pretty easy, pretty much put a static mesh or collision in it and crank up the projectile velocity.

After you got your projectile set up, you could either drag out the actor reference after spawning the projectile and bind event on hit and get the hit info, or send an event from the projectiles on hit. Make sure to destroy it on hit and add your hit particle

You mean “Spawn Actor”? But then I need to plug vectors into transform, and I don’t really know how to do this

depending on how accurate you want it to be, rather than actually spawning a bullet you can use your current system, and just spawn a hit particle effect, sound effect, decal, apply damage, add force, etc. at the hit location of your trace, or even spawn a projectile there which should automatically trigger any collision logic you have.

Alternatively, you can use find look at rotation from the start point to the trace hit/end point, spawn the bullet at the start location of the trace, plug the find lookat rotation into the spawn rotation for the bullet, and then in the bullets projectile movement component have it move forward at the desired speed. However, I should warn you that traces in general are much more accurate than overlap or hit events from objects, but this is how you would do what you are trying to do.

Ok nvm, it works. Thank you guys

oops i did mean spawn actor haha, glad you got it figured out with my messy info