Itween move within fixed area

Hi everyone,

I want to be able to move a game object smoothly within a confined area and I can not figure it out.

Im trying to get an object float around inside a 1x1x1 cube. Is this doable with iTween?

Thanks you

Im not sure what iTween is but im pretty sure that with a simple line of code u can achieve what u need, here are two commands you could use.
Vector3.lerp

or
Vector3.MoveTowards

Get back to me if this helps or not :slight_smile:

Edit
I just found this video, this guy seems to have a box moving pretty smoothy with iTween commands again i have never used it though.

Thanks Rory, I can make the objects move just fine its just I don’t know how to have an object float around randomly within a defined area.

For example if I was to make an object move a distance how would i keep it from moving outside the defined distance the next time it moves?

Sorry I mis-understood your first post, I cant help with iTween commands(sorry again).
However there are some standard Unity commands that I think you could use :slight_smile:

More than likely you could use the command:
Random.RangeThis creates a random value between two numbers
You can create three random values for XYZ thus creating a random Vector3.

If u just want to clamp a value between to other value’s you can use this command:

Mathf.Clamp

This clamps a value between two other value’s

Thanks I will give that a go