I have master object with some hitboxes. At some moments they can overlay a bit. They’re overlaying master all the time. This causes framerate issues and I don’t know how to fix it. So I have to make sure that they don’t collide each other aswell as don’t collide master, but they must collide whole scene. And they must be ghost type of objects that are parented to rigidbody master. Is it possible somehow?
Maybe if you change the collision groups and collision masks in the physics tab of the object.
I really don’t understand how they work. Are there any tutorials explaining this topic?
The collision group is what collision group the object is part of. So, if the first box is selected, the object is of the first collision group. If the first and second boxes are selected, the object is in the first and second collision group. For the mask, select all the boxes the object can collide with. So, if a cube is of the first collision group, and a plane below the cube is of the second collision group, and the cube collision mask is anything except the second one and the collision mask of the plane is anything except the first one, the cube will fall through the plane.
OK! I kind of got it, thanks!
So for whole scene I set groups to 1 and 2 and mask to everything. To hitboxes I set group 2 and mask to everything except 1. For master group 1 and mask to everything except 2. This should work fine, right?
I have all hitBoxes unparent move to match bones and then reparent compound to a root object
this gives you a accurate physics bound, and the child shapes can’t collide with each other, as they are parented.
Hitting any part of the compound object returns the root, so some math is needed to check where you hit*
Those hitboxes aren’t for a character. They’re for a car. Like collision detectors.
then why not just use the collision callback to get the hit contact?
you can then check the contact against a table of crumple/damage zones and apply damage based on the closest damage point to the contact?
use the sorted function and the distances to sort the contacts by distance,
the closest contact point will be list[0]
How to do it? I have never done such things. It would really help if I knew how do do a vertex collision check. I could than map parts to vertices and apply damage basing on impact at current vertex. Yeah, I need help with this as I don’t know how to check the colliding vertex and I don’t know any of this stuff at all(no experience)
google collision callback
there is a example callback there
you just run it 1 time and have it feed the hitPosition as a property to the hitObject,
this data is then used by python called by a collision sensor, or you could modify the callback to do everything you need,
let me know if you have to much trouble, and I will build a example or dig up one I have laying around,
OK! Could you actually make a tutorial video with explanatory? It would help all the community, I think;)
Maybe the physics type “Sensor” is what you need. It is ghost and registers collisions.
(Yes, they can’t be detected by other objects. They allow to detect other objects).
Sorry for bumping an old thread but I’ve been looking everywhere. How do I let bge know when an object is colliding with the sensor physics object type? The physics type thats listed with rigid body and static. Do I still have to use ray casts and collision sensors?
to detect collisions, you need to use a collision sensor brick, even for python.
@Deadalus:
You can use the collision callbacks in python so you do not have to use the bricks
@KiiNGz
What do you mean by:
How do I let bge know
The BGE already knows when the collision is happening.
@Daed
Actually, it is possible to have collision detection without a collision sensor (through collision callbacks), but many think using a collision sensor is cleaner (and it can be, but that depends on your implementations/circumstances). Please look at this post (the class example of collisionCallbacks):
@KiiNGz
Even so, I recommend using a collision sensor, and setting physics type to ‘Sensor’ as Monster has suggested for your “hitBox entities.” But what you want is up to you.
How do I let bge know when an object is colliding with the sensor physics object type?
You want the hitBox entities to detect the objects, and not the other way around. As sensors, they can sense dynamic and static objects.
So link a Collision Sensor to your sensor type physics objects, then:
if collisionSensor.positive:
print(collisionSensor.hitObjectList)