sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Creating a timer in script

    Scheduled Pinned Locked Moved SketchyPhysics
    1 Posts 1 Posters 8.4k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • robintR Offline
      robint
      last edited by

      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


      falling block.skp

      As one door closes another one slams in your face

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement