I’m trying to have the ability to turn on/off collision detection with CharacterControl. I tried this but that doesn’t appear to work and I don’t know why:
fun enableCollisions(collisions: Boolean) {
app.bulletAppState.physicsSpace.remove(player)
if (collisions) {
player.character.collisionShape = CapsuleCollisionShape(0.4f, 1.8f, 1)
} else {
player.character.collisionShape = EmptyShape(true)
}
app.bulletAppState.physicsSpace.add(player)
}
Any other options? Thanks!
Solved:
fun enableCollisions(collisions: Boolean) {
if (collisions) {
player.character.collisionGroup = COLLISION_GROUP_01
player.character.collideWithGroups = COLLISION_GROUP_01
} else {
player.character.collisionGroup = COLLISION_GROUP_02
player.character.collideWithGroups = COLLISION_GROUP_02
}
}
1 Like
you can either put the objects in different collision groups or you could write a filter. Filters are evaluated before the collision.
2 Likes
You can try CharacterControl.addToIgnoreList indicating the physics controls you whould like to avoid having collision with
yes, but in this case I want to disable collision detection with everything. It’s basically for an ‘edit mode’ in my game