简体   繁体   中英

Move an image based on collision impact

what I need is for when one image, for example, a ball, collides with another image, of another ball, then the ball being hit will move based on WHERE it was hit and how hard (if possible) it was hit. Both of these balls are moved using the accelerometer FYI. This image basically describes the process that I want to be done. 球1(底球)击球2(底球)并使球2从击球位置向上移动

I've looked around and haven't really found anything on this so I'm questioning if it's even possible on xcode? Thanks :)

You might want to look at Cocos2d game engine for this.
Cocos2d for Iphone
Also Box2D will provide the physics in you game.

Check out Cocos2d this should help you if you don't know much about the mathematics behind this. To determine the speed and direction of where the ball that is being hit should move you will need to calculate the first balls current forward vector as well as the constitution of restitution between the two objects (if memory serves). Cocos2D should do all this for you .. ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM