I am writing a custom Character Controller and I want to move my controller with a function like this:
function Move(dirGet:Vector3) {
dist = 0;direction = dirGet;
while(dist < direction.magnitude &! collision){
transform.position += (direction.normalized * step);
dist += step;
}
while(collision){
transform.position -= (direction.normalized * step);
} }
the problem is that collision is set in OnTriggerEnter and OnTriggerExit. So is there a way to check for Collision in the two while loops?