I have my isometric camera set up and diagonals working on my gamepad for player movement. Jump works fine, mostly. However, when I get near a block with a collider on it, and try to jump, the rigidbody appears to get “stuck” and jumps, but not with the velocity of when it is not neat the collider, so it does a little half jump. I’ve read that this is a common problem, but how do I fix it?
function MoveChar(){
if ((Mathf.Abs(Input.GetAxis("Horizontal"))>0.02) || (Mathf.Abs(Input.GetAxis("Vertical")) > 0.02))
{
Debug.Log(Input.GetAxis("Horizontal") + ", " + Input.GetAxis("Vertical"));
if (Input.GetAxis("Horizontal") > 0 Input.GetAxis("Vertical") > 0) transform.eulerAngles.y = 270;
else if (Input.GetAxis("Horizontal") < 0 Input.GetAxis("Vertical") < 0) transform.eulerAngles.y = 90;
else if (Input.GetAxis("Horizontal") > 0 Input.GetAxis("Vertical") < 0) transform.eulerAngles.y = 0;
else if (Input.GetAxis("Horizontal") < 0 Input.GetAxis("Vertical") > 0) transform.eulerAngles.y = 180;
transform.Translate(Vector3.forward * Time.deltaTime * 3.5);
}
}
function JumpHero () {
if (Input.GetButton("Jump") grounded) {
grounded = false;
//rigidbody.AddForce(new Vector3(0,700,0), ForceMode.Impulse);
rigidbody.velocity.y = 200 *Time.deltaTime;
}
}