Physics gravity appears very weak

Hello,

I have a character which doesn’t fall at a reasonable speed under gravity, rather he floats down to the ground. A fall which should take around 1 second, takes nearer 30s. Given the limitations of the physics engine (e.g. ignores air resistance) I would expect falls to be quicker not slower, so this is very odd.

Gravity is currently set to -9.8m/s2 (on y axis) which is correct. Altering this value is one way to solve the problem but it seems unlikely to me that Unity would ship with gravity out by 1-2 orders of magnitude - much more likely to be something I’ve missed.

I’ve read the docs a few times through and have read (I think) all of the existing posts on this matter but have yet to solve my problem. I’ve listed some of the specific things that I’ve tried/checked.

  • The drag is set to 0.001, although
    I’ve also tried zero.
  • The size of my
    character model is just under 2m tall.
    Picture 2 shows the character
    hovering next to a default cube -
    hopefully proof that the scale is
    indeed correct.
  • The scale settings of
    all parent (and child) nodes of my
    character are 1 across the board.
  • I’ve played with the mass of the rigidbody although
    (thankfully) this had no affect.
  • I removed the animations from the animation controller incase something was upping the y-value
  • I checked the Time.timeScale value is 1

Can I anyone point me to something that I may have missed please?

Picture 1: The character “tallguy” with the settings for the animator, rigidbody and capsule collider.

[17007-screen+shot+2013-10-25+at+13.24.47.png|17007]

Picture 2: The character positioned next to a 1m3 default unity cube to show the scale of the model

[17008-screen+shot+2013-10-25+at+13.24.55.png|17008]

I’ve found the following resolved the problem for me…

Firstly: you must have at least one animation on the AnimationController which is referenced by the Animator.

In my attempts to narrow down the problem I had removed all the animations in the hope of proving it wasn’t the animations at fault. In this case, if you have no animations, then you will get the slow-fall affect. I suspect this behaviour is a bug in Unity as gravity should still apply. If gravity were applied when no animations were on the Animator Controller, it would make it quicker to ascertain that the animation is at fault in some way.

[17010-screen+shot+2013-10-25+at+14.41.53.png|17010]

Secondly: Under the animation import settings, I selected the animation added to the Animator Controller. In this case “Idle”. I then baked the Y transforms of the root position into the pose.

[17011-screen+shot+2013-10-25+at+14.41.38.png|17011]

My character is now falling to earth with a bump. FYI, I’m using the male character pack by 3DRT.com.

You can cast a ray from the character to the ground and adjust it using Animator.MatchTarget function.

	void Awake() {
		Animator anim = GetComponent<Animator>();
	}
	
	void Update() {
		// Raycast down from the center of the character.. 
		Ray ray = new Ray(transform.position + Vector3.up, -Vector3.up);
		RaycastHit hitInfo = new RaycastHit();
		if (Physics.Raycast(ray, out hitInfo)) {
		// ..if distance to the ground is more than 0.5f, use Match Target
			if (hitInfo.distance > 0.5f){
			// MatchTarget allows us to take over animation and smoothly transition our character towards a location - the hit point from the ray.
				anim.MatchTarget(hitInfo.point, Quaternion.identity, AvatarTarget.Root, new MatchTargetWeightMask(new Vector3(0, 10, 0), 0), 0f, 1f);
			}
		}
	}

If MatchTarget does not work as you wanted, you can also replace it with:

	this.transform.position = hitInfo.point;

This will ensure that the character goes on the ground.