I have a Player with a capsule collider on him and i have various objects in the scene. Most of the objects have either mesh collider or box collider enabled. When i move my player and the player collides with any object, my player just starts flying into space, literally. Any way to fix this?
Thanks in Advance.
The code i have on my player is this:
using UnityEngine; using System.Collections; public class Controller : MonoBehaviour { Animator anim; Rigidbody rbody; float inputH; float inputV; int Life=20; bool Dead=false; public float sensitivity=10f; void Start () { anim = GetComponent<Animator> (); rbody = GetComponent<Rigidbody> (); } void Update () { if (Dead == false) { inputH = Input.GetAxis ("Horizontal") * 50f; inputV = Input.GetAxis ("Vertical") * 20f; anim.SetFloat ("inputH", inputH); anim.SetFloat ("inputV", inputV); float moveX = inputV * Time.deltaTime; float moveZ = inputH * 0.5f * Time.deltaTime; this.transform.position += this.transform.forward * moveX; this.transform.position += this.transform.right * moveZ; transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivity, 0); } if (Input.GetKey (KeyCode.Z)) Life--; if (Life == 0) Dead = true; anim.SetBool("Dead",Dead); } }