EDIT: It was the Animator after all. Apply Root Motion basically nullifies any physics based work.
I "know" this answer but I can't figure out what can possibly be wrong. My code is in FixedUpdate(). My Rigidbody2D has a Gravity Scale of 4 and a Mass of 1. For whatever reason a Gravity Scale of 1 just isn't strong enough to keep it from floating away. In the pictures below the little cubes should be marking each frame.
Using the below code I get a jagged leap movement. The object shoots upwards and falls like a feather.
if(Game.inputManager.GetKey("Jump").KeyPressed())
{
yForce = 1000f;
this.rigidbody2D.AddForce(Vector2.up*yForce);
}
And using another suggestion I distribute the force over a second of time.
if(Game.inputManager.GetKey("Jump").KeyPressed())
{
addForceTimer = 1;
yForce = 1000f;
}
addForceTimer -= Time.deltaTime;
if(addForceTimer > 0)
{
this.rigidbody2D.AddForce(Vector2.up*yForce* Time.deltaTime*4);
}
And I get a more desirable but still just as wrong movement where there is no hang at the top of the jump.
From what I thought I knew neither of these should be happening at all. The object shouldn't be falling at a constant speed like it is. Does anybody have any suggestions?
The character is animated if that can possibly have some sort of effect but I don't imagine it would.