Measuring a wheel rotations???

Get help using Construct 2

Post » Mon Jul 01, 2013 12:48 am

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
B
4
S
1
Posts: 51
Reputation: 502

Post » Mon Jul 01, 2013 7:03 am

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
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
34
S
13
G
8
Posts: 318
Reputation: 7,670

Post » Mon Jul 01, 2013 8:11 pm

[QUOTE=mystazsea] 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 [/QUOTE]

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.
B
4
S
1
Posts: 51
Reputation: 502

Post » Mon Jul 01, 2013 8:22 pm

Yeah, always avoid invisible objects when you can. You can do what you are after with just a bit of math ;)
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,674


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest