- Home /
Relative Rigidbody movement,
The situation stands as follows:
1. This is my first post, and sorry in advance for any mistakes that I am sure to make.
2. My most recent FPS project now involves platforms, which pose an unexpected problem : The movement of the player has to be relative to platform it is standing on. Until now I used a modified version of drag, which acted only on the horizontal axis, and that had a substantial drag coeficient, to work proprerly.
The problem is that it is bound to the rigidbody's inertial frame of reference, working directly on the velocity vector. I now need to adapt said system to the friction between the player's rigidody and the platform, and modify the drag coefiecient dynamically to stop the player from accelerating ad infinitum.
3.Until now I tried the following:
3.1 having friction and the modified drag script. This was the initial situation.
3.2 friction only, drag negligable. The player, after is overtakes the static friction and the maximum dynamic friciton, accelerates ad inifitum. 3.3 a stepper function. simulation of steps by modifying the friciton coeficient, according to an internal timer. function as follows: float StepFunction( float x ) { if( x == -1 ) { return 1; } if( x > 0.75f ) {return x / 2.5f; } if ( x > 0.5f ) {return x /2 ; } if ( x > 0.25f ) { return x; } return 0.25f; }
x is the timer variable, which goes from 0 to 1; special case -1, triggered when the player changes input, touches a new platform, or jumps.
It kinda works, but the stuttering is quite visible, and it does not scale with the relative speed, and it is still prone to acceleration ad infinitum. 4. I would wish to not use the "parent-to-platform" solution, or the standard assets, because I want to understand how all this works.,
Your answer
Follow this Question
Related Questions
Non slippery movement 1 Answer
Wall Running using Javascript 0 Answers
Do character controllers work with dynamic gravity? 1 Answer
How to detect angles of walls? 1 Answer