or in a function.
sync on
sync rate 0
hide mouse
autocam off
randomize timer()
make matrix 1,1000,1000,5,5
make object box 1,50,50,50
position object 1,500,0,500
do
SET_OBJECT_AREA(1,6.0,500.0,500.0,500.0)
rem Change these to alter the camera position
position camera x#,300,z#-300
point camera object position x(1),0,object position z(1)
sync
loop
Function SET_OBJECT_AREA(Obj,Speed#,XPos#,ZPos#,Radius#)
ObjX#=Object Position X(Obj)
ObjZ#=Object Position Z(Obj)
ObjA#=Object Angle Y(Obj)
Dist#=SQRT((ObjX#-XPos#)^2.0+(ObjZ#-ZPos#)^2.0)
If Dist#>Radius#
Point Object Obj,XPos#,Object Position Y(Obj),ZPos#
A#=WrapValue(A#-Speed#)
EndIf
YRotate Object Obj,A#
Move Object Obj,Speed#
EndFunction
ToXic.