Any way to do collisions without physics?

I would like to detect collisions between two objects, however, I do not want to use the physics (e.g. the bouncing and gravity effects). I would like to have different functions called depending on the two objects in the collision. Does anyone know of a way to do this?
Thanks in advance! [import]uid: 38000 topic_id: 12536 reply_id: 312536[/import]

You can of course manually detect collisions but, you can not make pixel perfect collision detection, for which you need low level bitmap operations. you can create bounding box collision detection, as a rectangle or a circle shaped bounding box.

If you search google for bouding box collision detection you can find the logic. All you need to do, is either setting up a timer listener, or a listener for “enterframe” runtime event. Withing that listener you are going to check coordinates of all your objects with each other.

For example in circle bounding box detection all you need to do is, to take two objects’ center point, and calculate the line length between these two points. if the resulting line length bigger then the both objects’ bounding box radius, then there is no collision, else you call the collision function for these objects.

However, I think you could and should still use the physics for detecting collisions, without using the other physics related features.

Check isSensor property: http://developer.anscamobile.com/reference/index/bodyissensor

you can use static sensor objects which i think not effected with gravity and other physical forces. Sensor objects will be “ghosts” in a sense, but they still trigger events.

Hope this helps… [import]uid: 46529 topic_id: 12536 reply_id: 45798[/import]

Thanks! So I just need to have a runtime listener check the coordinates and call the event when two objects collide. For the other physics option, what do I need to do to make an object “static”? If these objects will be dragged or moved by transition.to, will they still be qualified as “static”? [import]uid: 38000 topic_id: 12536 reply_id: 45836[/import]

http://developer.anscamobile.com/reference/index/physicsaddbody here you can find how to create physics bodies. There are 3 types of physics bodies dynamic (default), kinematic, and static. All you need to do is specifying which body type you want at the time of the creation of the physics object.

You can find useful information here : http://developer.anscamobile.com/content/game-edition-physics-bodies

As far as i know moving static objects should not be a problem. But I am not sure if two static objects “collide”. I they don’t, that means you should use “kinematic” type.

Which ever type you choose, then you should set isSensor property to true. That way they will not react physical forces.

I sense that, you haven’t read the physics documentation yet. If I were you I would go and read it first, that way you can decide what is the best way to implement your project. There is also a “shape” thing you might want to learn. By using polygon shapes at the creation of your physics object, you can almost achieve pixel perfect collision detection sensitivity on non-animated display objects.

There is a commercial 3. party tool called Physics Editor, and it has a evaluation version with some limited ability. You can use that tool, to define polygon shapes for your objects. [import]uid: 46529 topic_id: 12536 reply_id: 45861[/import]