Meshes, Physics and Trigonometry

Hi everyone, I have recently started working with rigidbodys instead of character controllers and everything was working fine and dandy until I decided it was time to put a ramp on the scene and try some jumps.
You see, I’m not a big fan of the Apply Root Motion thing so everything on my character movement is scripted, including jumps in the form of rigidbody.AddForce, little did I know meshes were so… susceptible… to physics.

Not exactly AAA material, as you can see, the mesh moves away from the actual game object, sinking into the ground and then kind of “lerps” back to its right position.
So far I have been unable to find a solution to this, but it may be some problem with the way unity handles mathematics, as shown in the next image…

It is not precisely a complex code, and I’m no Isaac Newton, but as far as I know tan(30) is somewhere around 0.57 which is a very different result from what I’m getting.
Anyways, I’m trying to find a solution for this weird behaviours, any ideas?

Does your jump animation internally move the character forwards? If so you need to compensate for that. Watch this video from 19:30 onwards - it shows how to compensate for an incorrectly-oriented run animation, but the process should be similar for removing net horizontal motion from your jump animation.

Regarding Mathf.Tan, the problem is that most Unity functions use angles in degrees, but the low level trigonometry functions use radians. You should multiply by Mathf.Deg2Rad before calling Mathf.Tan.

Mathf.Deg2Rad did in fact solve the tangent problem, thank you!
Regarding the animation, everyting is baked into pose and apply root motion is disabled, the only motion being applied to the character is rigidbody.AddForce(0, 1, 2, ForceMode.Impulse), the vector3 is actually transform.TransformDirection(etc.) but I guess you get the idea, so I’m still trying stuff to make it work right.
By the way, would you mind giving me a hand with this question? xD