As you can see, the farther down my object falls, the more thrashing there is.
What is causing this, once I turn gravity scale to zero?
using UnityEngine;
using System.Collections;
public class PlayerBehavior : MonoBehaviour {
Vector3 jumping;
public int jumpingPower;
float currentY;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
ControllerInput ();
}
void ControllerInput()
{
Vector3 move = Vector3.zero;
if (Input.GetKey(KeyCode.D))
move += Vector3.right3;
if (Input.GetKey(KeyCode.A))
move += Vector3.left3;
if (Input.GetKeyDown (KeyCode.Space) jumping.y == 0) {
jumping = (Vector3.up*jumpingPower);
}
if (Input.GetKeyDown (KeyCode.LeftShift)) {
jumping.y = 0;
rigidbody2D.velocity.Set(0, 0);
rigidbody2D.gravityScale = 0;
}
if (Input.GetKey (KeyCode.LeftShift)) {
move.y = 0;
rigidbody2D.velocity.Set(0, 0);
move.y += rigidbody2D.velocity.y * -1.0f;
}
if (Input.GetKeyUp (KeyCode.LeftShift))
rigidbody2D.gravityScale = 1.98f;
transform.position += (move + jumping) * Time.deltaTime;
//transform.position += Vector3.down* 9.8f * Time.deltaTime;
jumping.y *= .8f;
if (jumping.y < .2f)
jumping.y = 0;
}
}