Velocity drift?
Posted: Wed Sep 17, 2014 5:14 pm
I'm experiencing an odd behavior and was unsuccessful attributing it to my own code, so thought I'd post here to see if it's a known issue or if perhaps I'm doing something incorrectly.
The demo I'm developing to convince my team to use Chipmunk is a simple "carousel" of icons. The user swipes left or right to scroll through them and I apply an impulse (rather than a force) as they swipe. I'm not yet trying to vary that impulse based on speed and distance of the swipe, I'm just doing a small impulse as they drag their finger so the icons basically follow the finger. Damping is being applied to each icon so they will always come to rest and the impulse isn't that large so they come to rest fairly quickly.
Anyhow, the impulse I'm applying only has an 'X' direction component -- the 'Y' is always 0.0f. But what happens is the icons seem to all scatter in random directions of both X & Y. The 'X' change is one thing but I'm surprised that the 'Y' is ever anything but 0.0f since I never set it or apply any force/impulse along 'Y'.
Am I using something incorrectly? For example, one shouldn't apply repeated impulses to an object? It seems to mostly work as expected except for this 'y" business. The bodies for the icons show zero for Y correctly in the beginning, then drift fairly quickly to another 'Y' value and stay at that value as I swipe left & right.
Sorry for the long post, but I wanted to give you as much context as possible.
Thanks!
The demo I'm developing to convince my team to use Chipmunk is a simple "carousel" of icons. The user swipes left or right to scroll through them and I apply an impulse (rather than a force) as they swipe. I'm not yet trying to vary that impulse based on speed and distance of the swipe, I'm just doing a small impulse as they drag their finger so the icons basically follow the finger. Damping is being applied to each icon so they will always come to rest and the impulse isn't that large so they come to rest fairly quickly.
Anyhow, the impulse I'm applying only has an 'X' direction component -- the 'Y' is always 0.0f. But what happens is the icons seem to all scatter in random directions of both X & Y. The 'X' change is one thing but I'm surprised that the 'Y' is ever anything but 0.0f since I never set it or apply any force/impulse along 'Y'.
Am I using something incorrectly? For example, one shouldn't apply repeated impulses to an object? It seems to mostly work as expected except for this 'y" business. The bodies for the icons show zero for Y correctly in the beginning, then drift fairly quickly to another 'Y' value and stay at that value as I swipe left & right.
Sorry for the long post, but I wanted to give you as much context as possible.
Thanks!