--Create a custom attribute definition
ca=attributes myCaDef
(
	--Function for calculating the roll of a wheel
	fn wheel v r=
	(
		c=(2*pi*r)		--Circumference of the wheel
		deg=(c/6.28319) --c / Radians
		rot=v/deg		--Position / deg
		rot				--This isn't really needed
	)
)

--Create a control circle that will store the CA def.
cir=circle name:"Master"
--Add the CA def to the control.
custAttributes.add cir ca

--Create a cylinder to act as the wheel.
cyl=cylinder radius:30 height:10 name:"Wheel"
rotate cyl (eulerAngles 90 0 0)
move cyl [0,0,30]
--Apply a script controller to the y rotation of the wheel.
sCon=cyl.rotation.y_rotation.controller=float_script()
--Write the script controller, notice it is calling on the function stored in the control.
sCon.script="$master.myCaDef.wheel $wheel.pos.x $wheel.radius"

--Animate the wheel for demonstration.
animate on
at time 100 move cyl [200,0,0]



degTorad 360
