[SOLVED] How to return WHICH rigid body was hit?
Posted: Mon Feb 27, 2017 6:54 pm
I'm currently making a simple game with OpenGL and Bullet, and I have targets and walls in the scene. The targets are each given a collision shape of it's own mesh and the walls have a simple box shape.
I want my ray casting method to return something like "Hit target" or "Hit wall", as right now it just says "Hit" or "Miss" depending on whether the ray has hit a target. How can I differentiate between my rigid bodies in the scene, to know which I am currently hitting?
Right now, I'm just doing this (without the walls having collision shapes):
Apologies if this easily done, I'm still just getting into Bullet. Cheers though.
I want my ray casting method to return something like "Hit target" or "Hit wall", as right now it just says "Hit" or "Miss" depending on whether the ray has hit a target. How can I differentiate between my rigid bodies in the scene, to know which I am currently hitting?
Right now, I'm just doing this (without the walls having collision shapes):
Code: Select all
if (RayCallback.hasHit()) {
printf("Hit!");
}
else {
printf("Miss!");
}