creating a timer in script

Moderator: CPhillips

creating a timer in script

Postby robint » Fri Dec 16, 2016 1:12 pm

Hi SU fans
Can anyone help me make a timer to display the interval (secs) of a falling object hitting a baseplate (see model)

Faust kindly contributed this to detect the object hitting the plate - it resets on impact and I loose all the time info on screen. There is no pause or stop action to replace reset AFAIK

onTouch { |toucher, position, normal|
MSPhysics::Simulation.reset
}

I have discovered the

start_timer and stop_timer

action but don't know how to use it
Ideally the interval result should be displayed on screen or otherwise accessible, and there should be a facility to have a coeff to adjust the result to the correct answer - frig factor (1s) as I noticed the on screen timer/fps is not accurate and depends on several settings (time step, linear damping et al)

Sorry to be a Ruby newbie but trying my best :(
and this could be so useful for dynamic simulation validation
Cheers

Robin
0
As one door closes another one slams in your face
User avatar
robint 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 


 

Return to SketchyPhysics

Who is online

Users browsing this forum: No registered users and 1 guest

Visit our sponsors: