OnCollision and CollisionParameter

Nov 30, 2009 at 3:40 AM


Sorry if this question is to noobish or whatever but I am just getting started using Oops!

I was wondering if their was an oncollision property in the collision shapes or if there was an collision parameter.

I have been using my own physics engine for so long and I find those two things to be a great help

alot more efficient then manual checking every collision.

I saw there was an array of the collisions that occured in the CollisionGroup that contains each shape involved so I suppose i could check every collision to see if one of the shapes fits the description of object I want but before I give up and do that Id rather find an oncollision(CollisionShape) or something.

Also, I noticed the flags for collision response enabled and the collision group properties but is there a collision parameter

something like a CollisionParameter(CollisionShape shape) boolean?

Sorry if the answers are obvious and I just cant see them

Nov 30, 2009 at 4:29 AM

hi tlegion, all questions are welcome here.  :)

Currently, there is no per-shape-collision event to subscribe to get collision information as they happen, but there is an interface you can implement, called ICollisionCallback, that allows you accept/reject collisions as they happen or even modify if necessary for ANY collision regardless of any criteria.  To setup this type of notification up, implement the ICollisionCallback on a class (your Game class would work) and pass an instance of this class as a parameter to the constructor of the PhysicsComponent. 

Otherwise, currently, you would have to do what you described - after the physics simulation has ran for the frame (usually when PhysicsComponent.EndUpdate is called), you would have to iterate through the relevant CollisionGroup's Collisions collection.

I'm not sure what you're describing with the CollisionParameter(CollisionShape shape) boolean example.  Do you mean a method to call to determine if two collisiongroups/collisionshapes can be collided against?  Let me know.  I'm getting ready to release another version and I may have already included this functionality.

Mar 20, 2010 at 3:49 AM
Edited Mar 21, 2010 at 10:23 PM
fretboardoffury wrote:

I'm getting ready to release another version and I may have already included this functionality.


Is there any update on the framework about these elements since you wrote this message? Will there be some (about these elements too) in the next version? If yes, when do you expect releasing it?

Thank you

Mar 31, 2010 at 6:13 AM

Hey martox, sorry for the late reply.  I didn't see it until now for some reason.  After I fix a few issues with capsule collisions, I'll be creating a new beta release.  Probably in a week or two I hope.