Life is not a long quiet river...
This week-end, I again encountered problems with the 2 spinners. I had solved the spinner problems (before integrating FizX) by changing the T1 model to a T2 model (larger) because the ball sometimes blocked on the T1 model. With the XML parameters required by FizX, the ball no longer blocks on the T1 model (good !). So I went back to a T1 model (because the T2 model is ugly in narrow lanes), but the problem of spinners that get stuck in a horizontal position has made a comeback... again.
I tried changing the XML spinner settings without success.
So I took the bull by the horns ! (French expression).
I wrote a script to control the spinner rotation at the end of the stroke. When the spinner spins at less than 4 revolutions per second, I release the angulardamping (thanks to BAM !
). This prevents the spinner from braking too quickly and stopping in a wrong position (horizontal for example...). When the spinner spins at about 1 revolution per second, I start to control its angle. When the spinner reaches an angle of 30 to 60 degrees before vertical (vertical = 180° or 360°), I raise the angulardamping. This slows down the spinner more strongly, which stops around the vertical position (at 180° or 360°), what is the desired effect.
I handled 2 exceptions :
- when the ball speed is low, the spinner can start spinning with a speed lower than 4 rotations per second. In this case, I release the angulardamping from the start.
- with a low angulardamping, when the spinner is almost at a standstill, it risks starting to oscillate. In this case, I raise the angulardamping even if the spinner has not reached the desired angle.
I did some tests and it seems to work very well, now.
Cherry on the cake (French expression), it is possible to force the spinner to stop by always presenting the same face.
I hope that was the last problem to fix before publishing the table.