I am not very good in physics but almost have basic understanding of chipmunk. In my game, player is throwing a rock with certain angle and velocity throw catapult, in result stone is making projectile movement. Since wind speed and direction came as a strong factor in projectile movement. Depending on wind direction either wind pushes or resists stone's projectile movement.
I have done lot of googling, in most articles either they ignore wind or air resistance in projectile movement or give very complex formula's that I am unable to understand inspite of lot of hardwork. Since in games wind speed consideration is very common. Can any one explain me by giving physics formula or procedure that I implement in my game to restrict or pushes stone projectile movement depending on wind speed and direction. I am desperately waiting for reply. Bundle of thanks in advance
Wind Speed resistance against projectile movement
(5 posts) (4 voices)-
Posted 2 years ago #
-
If you use chipmunk, besides defining the global gravity, you should use cpBodyApplyForce also. Didn't test it though, but I don't see why it wouldn't work. That force is the same as gravity but you can set it on a single object/body (rock in this case).
Posted 2 years ago # -
I actually want following affect. Following paragraph is posted by someone on some forum. Can someone give me few lines of code doing exactly what he mention.
"One way would be to apply a force relative to the velocity. So the faster it gets, the bigger the force in the opposite direction. This is how real wind resistance works, which is why objects in free-fall in the Earth's atmosphere have a terminal velocity. As they get faster, wind resistance gets higher, until the force from wind resistance is equal to that of gravity, once that happens the body continues at the same speed, it is still falling but not falling faster. i.e. it has reached its terminal velocity."Posted 2 years ago # -
Check out Lhunath's Gorillas, http://gorillas.lyndir.com/, he uses wind to effect the throwing of bannanas etc.
Cocos2d and Chipmunk.
Justin
Posted 2 years ago # -
I would use what crmagicxxx wrote, which will give you the same effect you described.
I think you should set a terminal velocity (i think that is what is called) if not the object's speed will increment infinitely and it may end outside of screen...
Posted 2 years ago #
Reply
You must log in to post.