Question by
Vicmad · Nov 17, 2015 at 12:04 AM ·
gamesfalling-through-floor
object sometimes through the plane
I am learning to use Unity and I have a problem with a little game we've seen in a course. Is the maze game and the ball where you must move the maze to bring the ball to the goal. The problem is that the ball , sometimes , through the plane of the maze and falls into the void. Any help? thank you!
using UnityEngine;
using System.Collections;
public class controllaberinto : MonoBehaviour
{
public enum TGameState
{
PLAYING=0,
END_GAME
}
public float RotationalSpeed;
public GameObject Ball;
Vector3 StartPosition;
public TGameState GameState;
void Start ()
{
StartPosition = Ball.transform.position;
}
void Update ()
{
switch (GameState)
{
case TGameState.PLAYING:
UpdatePlayingGameState();
break;
}
}
void UpdatePlayingGameState()
{
if(Input.GetKey(KeyCode.A))
transform.Rotate(new Vector3(0.0f, 0.0f, RotationalSpeed*Time.deltaTime));
if(Input.GetKey(KeyCode.D))
transform.Rotate(new Vector3(0.0f, 0.0f, -RotationalSpeed*Time.deltaTime));
if(Input.GetKey(KeyCode.W))
transform.Rotate(new Vector3(RotationalSpeed*Time.deltaTime, 0.0f, 0.0f));
if(Input.GetKey(KeyCode.S))
transform.Rotate(new Vector3(-RotationalSpeed*Time.deltaTime, 0.0f, 0.0f));
}
}
Comment
Your answer
Follow this Question
Related Questions
Game Upload 1 Answer
Unity Displaying Transparent Meshes Wrong / 'Artifacts' ? 0 Answers
Why does my player object falling slowly through the floor? 0 Answers
empty project size 0 Answers
How to lose health when you enter a current "room" state. 0 Answers