x

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"

Negating Linear Velocity Along an Axis

I am creating a blueprint for a sort of "Alternative Friction" which should allow for assigning different friction values to different axis. To test this I have created the blueprint shown in the image. It simply takes the current X velocity of the physics parent and if it's within a range of -FrictionValue to +FrictionValue it sets the velocity in that direction to zero. The issue I am running into is that nothing seems to happen when it's run. The function is being called every frame as part of the tick event.

Other information:

  • Target Instance is referring to the chassis of the vehicle. I have tested adding velocity to it using the same reference the attached BP image uses so that shouldn't be an issue.

  • Target Velocity is really just a "Get Velocity (Actor)" node that is being done outside of the function for organization purposes.

  • I currently have both Friction values set to the maximum values of a float but it hasn't changed the results.

  • The friction values of the PhysicsMaterials are all set to 0.0 so that the results will be extremely clear. The vehicle simply slides infinitely in any direction no matter what direction it's facing.

  • I have tried using "Set All Physics Linear Velocity" but it had the same results.

If I'm going in the completely wrong direction with this solution and there's a better way to have specific changeable friction values for each axis then I would very much appreciate the input. As you might've guessed by the value names this is being used for a "Drifting" system where if the X Velocity gets high enough the friction lowers to simulate losing traction (the IsDrifting Bool). It's far from realistic but so is the project it'll be used for.

alt text

Product Version: UE 4.22
Tags:
bp.png (245.2 kB)
more ▼

asked May 04 '19 at 02:09 AM in Blueprint Scripting

avatar image

Jtoomer
1 1 3

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

1 answer: sort voted first

alt text

Fixed it, issue was due to Velocity being a world vector instead of a local one. By adding an "Inverse Transform Direction" node to the start so that I can work with it's velocity relative to the object then adding a "Transform Direction" node to make the velocity values valid for "Set Physics Linear Velocity" it will all work out.

Just remember to be careful when applying this. If say, the vehicle tips and the side is facing the ground it won't fall, not sure how to go about that, maybe add some sort of "As long as the bottom of the wheel/tread/whatever" is touching the ground apply this if not don't.

bp-solution.png (270.3 kB)
more ▼

answered May 06 '19 at 01:18 AM

avatar image

Jtoomer
1 1 3

(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