- Home /
Transform.Position Collision Issue
Ok so i use the below script in order to have a basic moving plane. Now imagine you have a moving platform like in Guitar Hero for example and the only difference is that the notes moving your way are objects that the player has to avoid. The player can move right or left using the Arrow keys. Now, if i make one of those objects the child of the moving plane that means the object is techically moving using the plane's script. The weird thing here is that the collision between the object and the player is not detected up front but from the sides or if you move the player a bit right or left :S Is there a way to make collisions completely detected from all sides? I tried to use the Character Controller method but i just don't get it how you make it go to other direction other than down! Also, the player has RigidBody attached. Thanks!
MovingPlane.cs
using UnityEngine;
using System.Collections;
public class MovingPlane : MonoBehaviour {
public int planeSpeed = 6;
public bool gameon = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(gameon){
transform.position += Vector3.back *Time.deltaTime *planeSpeed;
}
}
void OnGUI () {
if(GUI.Button(new Rect(20,20,50,50),"Start!")){
gameon = true;
}
}
}