How toSwitch LineTraceByChanel With actual Projectile?
I've been watching these tutorials (https://www.youtube.com/watch?v=5woOEEIIR3w) 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(:
asked Jan 19 '16 at 08:56 PM in Blueprint Scripting
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.
answered Jan 20 '16 at 06:30 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here