Detecting collisions without physics.

edited September 2012 in Help request
Hello,

I would like to know how can we detect collisions with ORX?
(Without using the physics calculation engine, just collisions engine). I read posts and found no solution without the physical response.

In fact, I need to create a function like this:

vCorrected = CorrectMoveVect( vMoving, cCollisionShape, &acCollected );

With:

vMoving : the moving hero vector.
cCollisionShape : a shape used by collision ( like Box or sphere )
acCollected : and returned array of colliding objects.

But if you have any other way to do it ...


Thank you for your help and sorry if the answer is already present in the forum.

a++
Numael

Comments

  • edited September 2012
    Collision comes with the physics plugin, there isn't any way to get it without the physics plugin beside rolling your own, that is.

    However, you can have the collision separate from the dynamics (the part that makes objects move and react to collisions).

    To do so, simply set all your shape with Solid = false in config, you'll get notified for all collisions (contact added and removed with all the info you need, including contact point, normal, shapes in contact, ...) as usual, but no actions will be taken by the engine, up to you to interpret them and act upon them as needed.

    Hope that helps! :)
  • edited September 2012
    Ok. Thank. This is perfect!
    I imagine that collisions are returned via events ... ?
  • edited September 2012
    Yep, orxPhysics.h contains the definition of event IDs and the payload. The hSender/hRecipient coming with the event contains both objects.

    For one collision add/remove between two objects, only one event is sent, so when listening for a specific object, check both the sender and recipient to make sure you won't miss it.
  • edited September 2012
    Ok thank you for these clarifications.


    a++
    Numael
  • edited September 2012
    My pleasure!
Sign In or Register to comment.