Sign in to follow this  
Hcwool

AS3 Collision Resolution

Recommended Posts

Collision detection in AS3 is done by call hitTestObject() function. That's all what you need. If you want check collisions for your object continuously - you can test collisions for each frame.
To resolve collisions you need to use some simple mathematics with vectors.
If you need to lock object movement when it's under wall (or floor, or ceiling), you need to check test collision and if it was found, prevent changing object coordinates.
If you need to reflect object movement (as billiard balls, for example), you just need compute movement vector according to simple physics rule. These rules depends on your environment. In simple situation it will be just a ray reflection. Of course, its very primitive methods, if you need more realistic image, you need to know physics laws and formulas. But often for AS3 it's enough.

Share this post


Link to post
Share on other sites
[quote name='Hcwool' timestamp='1347531395' post='4979654']
Hey, im trying to figure out collision resolution in as3. I have detection and stuff working i just cant figure out how to resolve it!?! any ideas?
[/quote]

If you're looking for polygonal collision detection and resolution in AS3, I have a couple of articles which might interest you:

http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/
http://www.wildbunny.co.uk/blog/2011/12/14/how-to-make-a-2d-platform-game-part-2-collision-detection/

Cheers, Paul.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this