Collision problem : Static, dynamic or kinematic ?? Static-Kinematic collision

Ok here is my scenario:

I want my player object in the game not to be affected by gravity. And an obstacle in the way of the player must not be affected by gravity as well.

Now how do I detect collisions between the player object and the obstacle. The player object cannot be kinematic because I do not think Corona allows you to detect collisions between a kinematic and a static object. And Collisions between static objects is not possible as well.

You can use a kinematic body because kinematic bodies are affected by forces but not by gravity, you can read about physics bodies here. Now for the detection, it sounds like you are going to have to use a collision detection function, you can read about it and find samples here.
If you need any more help, let me know.

-Chris

Hi Chris,

I Do not think you understood my question. To not being affected by gravity, my objects must be either static or kinematic.

Since I need both player object and obstacle to be non-gravity-affectable, Both must be either static or dynamic.

Now Corona doesnt detect collisions between 2 static objects or collision between a static and kinematic object

Oh I understand now, i'm not completely sure, but i don't think that is possible, like you said you can only detect static and dynamic or dynamic and kinematic collisions. What are you trying to do with this? Maybe there is another way of approaching it, with the same result in your app.

I think you can set object.isSensor=true and detect the collisions.

I think...

Good luck

Larry

DoubleSlashDesign.com

Yup.

Setting an object to dynamic and setting it as a sensor body sounds like the way to go.

Setting a dynamic body as sensor body doesn't make it non-affect-able by gravity right? The sensor body still responds to gravitational force.

Still,never mind. I found a work around solution.
Thanks for your replies. :)

you could still set your bodies to kinematic and static but also set the isSensor = true that way you can detect when a collision occurs.

But if you found a work around what did you do ?

Thanks

Larry

@Larry

I needed both my character AND the obstacle to be non-gravity-affectable. So both cannot be dynamic, and hence collisions can't be detected(as corona requires at least one object to be dynamic for detecting collisions).

Solution? I needed this above mentioned scenario only for certain durations. So I changed the bodyType of the objects dynamically using some other sensors.

:)

views:2031 update:2011/10/11 8:57:46
corona forums © 2003-2011