Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How to make moving object with colliders collide properly?

$
0
0
#pragma strict public var Target : Transform; public var speed : float = 2; public var slow : float =1; function Start () { } function Update () { transform.LookAt(Target); if(Input.GetButton("stop")) { transform.Translate(Vector3.forward * slow * Time.deltaTime); } else { transform.Translate(Vector3.forward * speed * Time.deltaTime); } transform.position.x = Mathf.Clamp(transform.position.y, 0, 0); } So i made this scirpt and it works how i want it to work except for when i try to put in colliders it starts to fly away and it becomes uncontrolled how can i fix this?

Viewing all articles
Browse latest Browse all 171066

Trending Articles