Notifications
Clear all

[Closed] script controller 'update'

Hello all!
A small question: is it possible to specify how often a script controller is evaluated? I am trying to ‘simulate’ a proximity sensor with max, so I have a script controller on the multiplier of an omni. The controller shoots a ray, whenever it intersects with a mesh it sets the value of the multiplier according to the distance of the mesh. It works just fine, actually, it is too perfect, every small change of the mesh affects the multiplier. So, I am wondering, is it possible to make it less sensitive? that is, if the mesh passes too fast in front of the light, nothing will happen?? I thought that if I could specify how often the controller is evaluated, it will do what I want…
here is my code:

theInt = IntersectRay myMesh (Ray omnPos [-1,0,0])
 if (theInt != undefined) then
 (
 	distUse = length(theInt.pos - omnPos)
 	if (distUse<dmax) then
 	(
 		glMult*(1-(distUse/dmax))
 	)else(
 		0
 	)
 )else(
 	0
 )
2 Replies

Could you perhaps track the frame number of the last update and make the controller only evaluate if the current frame number is greater than x times that?

thanks matt. yes, I guess that something like that will work, if I have my mesh animated. however, i don’t have animation, i just want to be able to move my mesh around (manually) and see the results… or, now that I think about it, maybe i could have playback on and then just move the mesh around… should try that…