Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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(:

Product Version: UE 4.9
more ▼

asked Jan 19 '16 at 08:56 PM in Blueprint Scripting

avatar image

9 2 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jan 20 '16 at 06:30 AM

avatar image

1.4k 70 29 93

avatar image Daryn36 Jan 20 '16 at 08:45 PM

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.

avatar image jtsmith Jan 21 '16 at 02:39 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question