- Home /
Roll a Ball Tutorial: Ball floats in the air when I enter play mode.
I'm on step 6 (collecting objects) in the Unity Roll a Ball tutorial and whenever I enter play mode the ball decides to float by about .5 units above the ground. It sets itself of the ground when I exit play mode. How do I fix this?
This is what my code looks like:
using UnityEngine; using System.Collections;
public class Playercontroller : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}
What collider did you attach to the blue surface plane?
Answer by nairpranav · Oct 17, 2016 at 06:04 PM
I have not attached a collider to that plane (the ground plane)
This is what it kinda looks like:
Answer by Paul_Eliasz · Oct 18, 2016 at 09:21 AM
You have to make sure that Convex is off in your mesh collider! You dont need this option since you dont collide with other mesh colliders. Otherwise it will create this invisible box collider which makes your ball look like its hovering over the ground!
Your answer
Follow this Question
Related Questions
What is floating point precision limitations and how to deal with it? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Play sound multiple times upon collision 1 Answer
ground detection fails 0 Answers