| View previous topic :: View next topic |
| Author |
Message |
Erkokite Guest
|
Posted: Mon Apr 25, 2005 2:27 pm Post subject: triggering a function during a collision |
|
|
| Is there a way to trigger a user-defined function whenever an object collides with another? For example, in my game engine, each entity class has an OnCollision() function. It would need to be triggered whenever the entity's associated collision object collides with another. |
|
| Back to top |
|
 |
erkokite Guest
|
Posted: Mon Apr 25, 2005 2:36 pm Post subject: |
|
|
| PS, the object will usually not be a ghost. |
|
| Back to top |
|
 |
kurtz
Joined: 02 Apr 2005 Posts: 56
|
Posted: Tue Apr 26, 2005 2:49 am Post subject: |
|
|
| For each dynamic object, you can obtain a collision iterator after each update that will give you all the collisions for that object during the last update. You can then look through all of the collisions and trigger the appropriate functions accordingly. Hope that helps. |
|
| Back to top |
|
 |
luke Site Admin
Joined: 15 Oct 2004 Posts: 621
|
Posted: Tue Apr 26, 2005 1:01 pm Post subject: |
|
|
| There have also been some new call back functions added in version 1.0.0.3 to TA::Physics. SetPreProcessCollisionCallBack and SetPostProcessCollisionCallBack. These can also be used. |
|
| Back to top |
|
 |
Erkokite Guest
|
Posted: Tue Apr 26, 2005 4:28 pm Post subject: |
|
|
| Excellent, thanks. |
|
| Back to top |
|
 |
benjamin Guest
|
Posted: Wed Apr 27, 2005 6:26 am Post subject: |
|
|
What exactly are the semantics of thise collision callback functions?
are they called for each collision event separately or will they be called when all collisions for a physicobject are calculated? |
|
| Back to top |
|
 |
luke Site Admin
Joined: 15 Oct 2004 Posts: 621
|
Posted: Wed Apr 27, 2005 10:12 pm Post subject: |
|
|
These functions are called for each individual collision.
If there are multiple collisions between 2 objects, the functions will get called multiple times, once for each collision between the 2 objects. |
|
| Back to top |
|
 |
benjamin Guest
|
Posted: Thu Apr 28, 2005 6:39 am Post subject: |
|
|
| Cool, thanks a lot |
|
| Back to top |
|
 |
|