How toSwitch LineTraceByChanel With actual Projectile?

I’ve been watching these tutorials (Creating AI in UE4 Part 8 - Skeletal Sockets and Destruction - YouTube) and in the tutorial we set up Firing functionality in our characters event graph using the LineTraceBChannel Node. I’ve been trying to figure out how exactly to replace this node with my rifle and projectile meshes and still have it attached to my health interface. Every Attempt I make things become really buggy. Does anyone know how to replace the linetrace node with my actual meshes? Let me know if this doesn’t make sense or you need more information. Thanks(:

First you need to create a projectile blueprint which has the proper mesh you want as well as any custom collisions you need. Ensure you have physics enabled. In you projectile blueprint, include a ‘Projectile Movement’ component and set your impulse/velocity and any other relevant data in the details pane of your Projectile Movement component. For damage you will need to use the ‘Event Hit’ node to run you logic, including to ‘Apply Damage’ when it hits an object. Also make sure that there is a Static Mesh component and set that to whatever mesh you want your projectile to be.

Then, in your blueprint to replace the Line Trace node, you simply ‘Spawn Actor From Class’ and tell it the class you want to spawn is your custom projectile and give it a transform (it’s location is typically a socket you create at the end of your gun).

There is quite a bit more to it than I lay out here but ultimately, to answer your question as literal as possible, you replace the line trace with the Spawn Actor node. I just wanted to give you a little more info on what should be used to properly do projectiles. While you can spawn a regular mesh as your projectile without creating the whole projectile blueprint, it is highly advised you do so. I would suggest opening a new project of the ‘First Person Shooter’ template and see how they setup their projectile as well as how to fire it from their gun.

I switched the line trace with spawn actor from class but now I cant get the projectile to fire from my gun. It fires from above my character and when I use the location and rotation references from the fps the projectile collides with my mesh exploding before it shoots.

You need/should create a socket on the mesh of your gun. Open up the mesh editor and in the details pane you should see a button called “Add Socket”. Name it something appropriate like “MuzzleSocket”. I suggest putting the socket just outside the collisions of your mesh. Also ensure that the X direction (red arrow) of the socket matches the direction you wish your projectile to travel as that is the direction the projectile will travel by default.

Then, to be on the safe side, ensure that the collisions of your projectile class do not “Block” the Object Type of your weapon. This is why the projectile doesn’t move; it is colliding with the gun (or your character) collisions.