Ok, I won'tLOL, don't hang yourself...
Thanks for explanations!
Did you mean this part?The "Distance", value in the formula... Which is +(distance), and I put +(distance*10).
I must admit my naming of variable was dirty indeed.Speed = MySensors(%sensor_front).distance
TBGL_EntityPush(%sScene, %eVehicle, 0, 0, Speed/FrameRate)
In fact the Speed/FrameRate equals to:
which equals too<distance> / ( 1 / <timeOfFrame>)
which is basically speed shift. Like from that velocity = distance / time basic formula.<distance> / <timeOfFrame>
Time for explanation ...I LOVE the sensors... I just didn't understand how they work
When you render image using OpenGL, you are able to retrieve x,y,z value of every pixel rendered.
So ... to get distance sensor-obstacle, I used dummy camera put at place and direction of sensor, rendered image ( at supertiny resolution ) from there ( just to memory, not to screen ) and read the x,y,z value of center pixel. Then I calculated distance sensor-(x, y, z) ... and that is what goes into sensor.
I am looking forward to your physics calculations, I am currently working on particles again, to go according to plan
How the drunk cube knows where to go?
We take as fact the track has left and right border. Then in case distance from left sensor is too small, we turn right; if distance from right sensor is too small we go left. That keeps the object on "drunk man straight line aproximation".
The front sensor is used to calculate that controversial speed - if there is lot of space in front of cube, it can afford to go faster, if little space, it is going slower.