sasikalar / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

LogicSensor with frequency: sensor has to fire first then start frequency #197

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use always-sensor in on-mode with frequence 200
2. increment a property

What is the expected output? 
It should be incremented immediately and after that wait for the frequency time

What do you see instead?
At first call it is waited for the frequency time and then the sensor is fired 
the first time

Acutally I wonder how the frequency is calculated in ogrekit:
GK_INLINE void setFrequency(int v)             {m_freq = (int)((((float)v) + 
.5) / 2.0);}

Where is the sense behind that forumla! Frequncy at last is not very useful in 
that state as it is frame-based (right!?) and the behvaiour can differ 
dramatically on different frame rates. 

Original issue reported on code.google.com by thomas.t...@googlemail.com on 8 Nov 2011 at 4:20

Attachments:

GoogleCodeExporter commented 9 years ago
The frequency is based tick not frame rate.
And tick rate is hard coded to 60 tick/sec, but LogicBrick tick rate is 120(?) 
tick/sec. It maybe bug.

#define ENGINE_TICKS_PER_SECOND gkScalar(60)

Patch is applied to trunk. Thanks for patch.

Original comment by harkon...@gmail.com on 11 Nov 2011 at 2:11

GoogleCodeExporter commented 9 years ago

Original comment by thomas.t...@googlemail.com on 13 May 2012 at 9:07