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.
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.
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here