Rotate Object is Player near..

How i do that?

I want, if the player are near by my GameObject, it automatic Rotate. (But no more than 1x. Time)

Do have anyOne a script for me?


The fastest (performance wise) way to do this is to add a sperical trigger to your player with a radius equal to the distance you want.

then, add this to the object that rotates:

function OnTriggerEnter (other : Collider) {
var target=other.transform;


(this will only rotate it once, and is untested code)