Player Vehicle Clipping Through Only Y-Axis
I'm testing out a very basic plane simulator, but there's a problem that I can't figure out. My plane is a rather simple model with a box collider on it, and the code: using UnityEngine; using System.Collections;
public class planeMovement : MonoBehaviour {
public float speed = 200;
public float turnSpeed = 100;
public Rigidbody rb;
void Start(){
rb = GetComponent<Rigidbody> ();
}
void FixedUpdate () {
float moveVertical = Input.GetAxis ("Vertical");
float moveBarrelRoll = Input.GetAxis ("BarrelRoll");
float moveTurn = Input.GetAxis ("Horizontal");
float moveDive = Input.GetAxis ("Dive");
transform.position += transform.forward * Time.deltaTime * moveVertical * speed;
transform.Rotate(Vector3.forward * Time.deltaTime * moveBarrelRoll * turnSpeed);
transform.Rotate(Vector3.up * Time.deltaTime * moveTurn * turnSpeed);
transform.Rotate (Vector3.right * Time.deltaTime * moveDive * turnSpeed);
rb.velocity = new Vector3(0, 0, 0);
}
}
The code is supposed to let the plane turn on all three axes, plus move forwards and backwards. It has a rigidbody but no gravity. This all seems to work well enough. When I try to collide with a cube for testing, the plane has no problems hitting and stopping at the sides of the cube. But when I try to test the plane on the top or bottom, it just clips through! The cube has equal sides and the colliders are set up... Any ideas why this may be happening? Thanks in advance.
Your answer
Follow this Question
Related Questions
Collisions in Editor Test Runner 0 Answers
Particle Collision between particles 0 Answers
Get list of enemies in range 1 Answer
Compatible collision constraint methods 0 Answers