Measuring a wheel rotations???

  • I'll try keep it simple,

    I have a bike wheel and I want to add a sound effect for each 36degrees of rotation but I cant find a way to measure the wheel rotations, or how to distinguish it to add events. everything is physics in the game.

    any help much appreciated <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Even though its Physics...The 'Angle' of the Object wheel would be still registered as normal..

    So you could place a Variable or two on the wheel that for example is

    something like...

    'Wheel_initial_Angle'

    &

    'Wheel_updated_Angle'

    or similiar

    Do a Every tick function

    Every Tick-> set 'Wheel_initial_Angle' to Wheel Angle

    Then then compare the Values every x seconds..dependant on the maximum required level of sensitivity..say every 0.5 secs.would need testing of course

    {System->Every 0.5s->

    Compare two values ->

    [Wheel_updated_Angle > (greater than)Wheel_initial_Angle Action Play your sfx or anything else.. or you could set it up any number of ways Boolean Variable" Wheel Rotate 36 degrees" Is 'Wheel_updated_Angle 36 degrees greater than 'Wheel_Initial_Angle' -> Set Boolean Variable" Wheel Rotate 36 degrees" TRUE -> FIRE SFX -> Reset variables..specifically up date the Initial and updated variables There would be plenty of ways to do what you what its just a matter of finding the BEST idea for you This may take considerable testing phase ..but you would learn alot..:) work for you? first value would be the WHEEL angle and
  • Even though its Physics...The 'Angle' of the Object wheel would be still registered as normal..

    So you could place a Variable or two on the wheel that for example is

    something like...

    'Wheel_initial_Angle'

    &

    'Wheel_updated_Angle'

    or similiar

    Do a Every tick function

    Every Tick-> set 'Wheel_initial_Angle' to Wheel Angle

    Then then compare the Values every x seconds..dependant on the maximum required level of sensitivity..say every 0.5 secs.would need testing of course

    {System->Every 0.5s->

    Compare two values ->

    [Wheel_updated_Angle > (greater than)Wheel_initial_Angle > > Action Play your sfx or anything else.. > > or > > you could set it up any number of ways > > Boolean Variable" Wheel Rotate 36 degrees" > > Is 'Wheel_updated_Angle 36 degrees greater than 'Wheel_Initial_Angle' > -> > Set Boolean Variable" Wheel Rotate 36 degrees" TRUE > -> FIRE SFX > -> Reset variables..specifically up date the Initial and updated variables > > There would be plenty of ways to do what you what > > its just a matter of finding the BEST idea for you > > This may take considerable testing phase ..but you would learn alot..:) > > work for you? > first value would be the WHEEL angle and Hi thanks for your reply, your ideas sound interesting and I am going to definitely test them I figured out a way last night, its very basic and mundane but does the trick I pinned invisible circles to every spoke of the wheel and 1 circle to the bike frame and set a sound for ever collision between the frame circle and spoke circle, I got the desired effect of a slow ticking of the chain when rolling slow and a fast ticking when up to speed. Time to try your ideas so I get to grips with more of the maths and physics equations. It will surely shorten my code atleast.

  • Yeah, always avoid invisible objects when you can. You can do what you are after with just a bit of math ;)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)