Basic rotation question?

I know this is a basic question, but I’ve looked in the docs and I couldnt seem to get what I found to work. How can I make an object constantly rotate at a set velocity? (yeah I know it’s simple, kind of embarasing)

Edit: I also have some additional questions.

Another simple one, but how can I have an object just randomly drift around, but within a set range (ex: it doest go outside a room or a radius area. It just drifts another direction)

How can I access the scale of an object with a function (ex: function is called, then the object doubles in size.

How can I instantiate objects relative to a central object (so they spawn within a certain range. I looked in the docs and I could nit get the script to work how I wanted).

How can I make an object move to avoid another specified object?

Thank you.

Did u look in the scripting manual under runtime classses / transform / rotate ? things to remember if you dont know.

(1) move the Time.deltaTime to the axis you need to rotate.

(2) * it by using an float like (eg) 1.0* Time.deltaTime.

//rotate 30 degrees around y-axis every second
function Update()
{
transform.Rotate(0, 30 * Time.deltaTime, 0);
}

you can Random function. For example,

var dir : int = Random.Range(50, 200);

you can use condition statement to check the dir and assign a positive or negative value. For example,

function Update()
{
transform.Translate(0, 0, dir * Time.deltaTime);
}

// transform.position is your current game object that the script is attached to. You can vector3 to add to the transform.position. For example,

Instantiate(YourGamePrefab, transform.position + Vector3(0, 0, 5), transform.rotation);

I’ve decided to forgo that idea for now, but thanks for your help. Can anyone else help me any of the other questions?

Take a look at Transform.localScale.

I suggested a solution in your other thread. If you tried it and couldn’t get it to work, post the code along with a description of the problem you’re having.

That’s not necessarily trivial, but ‘steering behaviors’ might be a good place to start (Google/forum search will tell you more).