Hi there!
Here’s my situation:
I am making a game which involves the player being on a train moving really really fast. The problem is that the game is based upon the movements of the train, which does loops, barrel rolls and stuff and the player has to not fall out of it, so i can’t just fake the trains movements by moving the outside set instead.
Now the issue i’m having, as you read the title, is that i cannot, for the love of me, find a way to do a convincing (nor even working and “universal”) inertia for the player. I mean i first wanted to make the character’s world moves always affected by the ground’s moves (by applying the ground’s speed or anything every frame) but it turned out lame and not working at all, so i decided to parent the player to the ground, and unparent it every time he wasn’t on the ground, and only then apply a force in the direction the ground was going. That also turned out not working at all, because of the huge speed of the ground and the inaccuracy of the addforce; making it, at best, landing back or forth of the position he jumped from, and having to find the exactly accurate multiplier for the impulse force, which was something around 200.000 or something, which is stupid.
So another way i thought about was to add a ground “tracker” at the player’s feet and parent that to the ground instead of the player, make the player follow its x and z values when on the ground (not the y, to make it possible for the ground to suddenly go down, making the player “hover” and start falling, which would be awesome), but then again, adding a force when jumping wasn’t an option, so keep the ground tracker on the ground as long as the ground isn’t too far below the player (an arbitrary serialized value), and then only add an impulse to simulate an inertia.
With this solution, not only is the impulse not working again (cause having to multiply the ground “speed” (calculated by subtracting the last frame’s ground’s position by the current one) by a huge value for some reason i don’t even understand anymore, and because the train’s ground might have some holes in it that the player should be able to jump over without being counted as “falling”). The other problem being that the entire game’s based on a grappling the player uses to move around the train (zelda-like grappling (attracting, not swinging)), so theorically the player would be in the air most of the time so…
Anyway so, after litterally one month of attempts and failures, i’m starting to feel really tired of this problem and i’m beginning to lose any understanding i have about anything, about how the unity physics works exactly (the addforce never works exactly as i intend for example), and i’m running out of ideas on how to make that damned inertia, so i’m turning to you to see if you would have any idea on how to make this thing work please?
Here is a quick video to show the game and how it works, so you can see my problem more clearly i hope: - YouTube