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"

Apply Force In Direction Of Line Trace?

Hello, so I have a line trace that aligns my character to the surface and once it reaches a certain point I disable gravity and enable flying so I can go past 90 degrees.

Once I'm in this flying no gravity state though Its very easy for my character to float away from the surface.

My question is how can I apply a directional force (possibly from the line trace?) downward from my character to make them stick to the surface its aligned on?

Product Version: UE 4.20
more ▼

asked Oct 15 '18 at 05:10 PM in Blueprint Scripting

avatar image

75 2 4 8

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

1 answer: sort voted first

This is really simple to do because the line trace gives you all the information you need. The hit result will contain something called the impact normal. This is the direction the hit surface is facing.

All you need to do is take the impact normal vector and multiply it by a negative number (opposite of the surface direction) that you feed into an add impulse node. You can do this off of tick or a timer if you need it to be consistently added.

Make sure to check velocity change on the add impulse node to factor in the mass of the target.

alt text

annotation.png (208.7 kB)
more ▼

answered Oct 15 '18 at 05:28 PM

avatar image

Steve SybrSyn
1.5k 4 5 10

avatar image Jinkuu Oct 16 '18 at 07:24 PM

Thanks I was able to add force to the character movement with this although it doesn't exactly make the character stick to the surface as I had hoped, I think this is due to the flying movement mode.

I'll mark this as answered though thanks for the help!

(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