Skip to main content

I set off to create a rigged door, thinking a single mesh object with moving parts should be easier to manage than having each part as a separate object - especially once there are a large number of doors in a level and some doors have many animated parts.

If the physics calculations turn out to be too slow I will reconsider this approach, but I want to test it out. Besides, knowing how to update the physics mesh will be useful for many other situations too.

Here is my test scene with a player object (Character collision type) that falls onto a trap door mesh object. Collision with the mesh object triggers a Message to its parent armature and an Action Actuator plays the rigged animation of the door opening. This part is working fine.

enter image description here

From what I've read, when a mesh deforms, if collisions are required it must be updated using reinstancePhysicsMesh()

Official documentation on it is here, but to be honest I don't understand all of what's written there. For example, it seems that arguments are optional, but are they optional in my case? Not sure.

I tried writing a simple script for this, but I believe my syntax is wrong because the player object does not fall through the trap door, and as you can see from the physics debugging visualization, the physics mesh is not updating.

Logic:

enter image description here

Script:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

char_coll = cont.sensors["CharColl"]

if char_coll.positive:
    print("Character collision detected")
    own.reinstancePhysicsMesh()

I set off to create a rigged door, thinking a single mesh object with moving parts should be easier to manage than having each part as a separate object - especially once there are a large number of doors in a level and some doors have many animated parts.

If the physics calculations turn out to be too slow I will reconsider this approach, but I want to test it out. Besides, knowing how to update the physics mesh will be useful for many other situations too.

Here is my test scene with a player object (Character collision type) that falls onto a trap door mesh object. Collision with the mesh object triggers a Message to its parent armature and an Action Actuator plays the rigged animation of the door opening. This part is working fine.

From what I've read, when a mesh deforms, if collisions are required it must be updated using reinstancePhysicsMesh()

Official documentation on it is here, but to be honest I don't understand all of what's written there. For example, it seems that arguments are optional, but are they optional in my case? Not sure.

I tried writing a simple script for this, but I believe my syntax is wrong because the player object does not fall through the trap door, and as you can see from the physics debugging visualization, the physics mesh is not updating.

Logic:

enter image description here

Script:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

char_coll = cont.sensors["CharColl"]

if char_coll.positive:
    print("Character collision detected")
    own.reinstancePhysicsMesh()

I set off to create a rigged door, thinking a single mesh object with moving parts should be easier to manage than having each part as a separate object - especially once there are a large number of doors in a level and some doors have many animated parts.

If the physics calculations turn out to be too slow I will reconsider this approach, but I want to test it out. Besides, knowing how to update the physics mesh will be useful for many other situations too.

Here is my test scene with a player object (Character collision type) that falls onto a trap door mesh object. Collision with the mesh object triggers a Message to its parent armature and an Action Actuator plays the rigged animation of the door opening. This part is working fine.

enter image description here

From what I've read, when a mesh deforms, if collisions are required it must be updated using reinstancePhysicsMesh()

Official documentation on it is here, but to be honest I don't understand all of what's written there. For example, it seems that arguments are optional, but are they optional in my case? Not sure.

I tried writing a simple script for this, but I believe my syntax is wrong because the player object does not fall through the trap door, and as you can see from the physics debugging visualization, the physics mesh is not updating.

Logic:

enter image description here

Script:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

char_coll = cont.sensors["CharColl"]

if char_coll.positive:
    print("Character collision detected")
    own.reinstancePhysicsMesh()

Bumped by Community user
Tag(s) added.
Link
Mentalist
  • 19.4k
  • 9
  • 98
  • 172
Detail added.
Source Link
Mentalist
  • 19.4k
  • 9
  • 98
  • 172

I set off to create a rigged door, thinking a single mesh object with moving parts should be easier to manage than having each part as a separate object - especially once there are a large number of doors in a level and some doors have many animated parts.

If the physics calculations turn out to be too slow I will reconsider this approach, but I want to test it out. Besides, knowing how to update the physics mesh will be useful for many other situations too.

Here is my test scene with a player object (Character collision type) that falls onto a trap door mesh object. Collision with the mesh object triggers a Message to its parent armature and an Action Actuator plays the rigged animation of the door opening. This part is working fine.

From what I've read, when a mesh deforms, if collisions are required it must be updated using reinstancePhysicsMesh()

Official documentation on it is here, but to be honest I don't understand all of what's written there. For example, it seems that arguments are optional, but are they optional in my case? Not sure.

I tried writing a simple script for this, but I believe my syntax is wrong because the player object does not fall through the trap door, and as you can see from the physics debugging visualization, the collisionphysics mesh is not updating.

Logic:

enter image description here

Script:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

char_coll = cont.sensors["CharColl"]

if char_coll.positive:
    print("Character collision detected")
    own.reinstancePhysicsMesh()

I set off to create a rigged door, thinking a single mesh object with moving parts should be easier to manage than having each part as a separate object - especially once there are a large number of doors in a level and some doors have many animated parts.

If the physics calculations turn out to be too slow I will reconsider this approach, but I want to test it out.

Here is my test scene with a player object (Character collision type) that falls onto a trap door mesh object. Collision with the mesh object triggers a Message to its parent armature and an Action Actuator plays the rigged animation of the door opening. This part is working fine.

From what I've read, when a mesh deforms, if collisions are required it must be updated using reinstancePhysicsMesh()

I tried writing a simple script for this, but I believe my syntax is wrong because the player object does not fall through the trap door, and as you can see from the physics debugging visualization, the collision mesh is not updating.

Logic:

enter image description here

Script:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

char_coll = cont.sensors["CharColl"]

if char_coll.positive:
    print("Character collision detected")
    own.reinstancePhysicsMesh()

I set off to create a rigged door, thinking a single mesh object with moving parts should be easier to manage than having each part as a separate object - especially once there are a large number of doors in a level and some doors have many animated parts.

If the physics calculations turn out to be too slow I will reconsider this approach, but I want to test it out. Besides, knowing how to update the physics mesh will be useful for many other situations too.

Here is my test scene with a player object (Character collision type) that falls onto a trap door mesh object. Collision with the mesh object triggers a Message to its parent armature and an Action Actuator plays the rigged animation of the door opening. This part is working fine.

From what I've read, when a mesh deforms, if collisions are required it must be updated using reinstancePhysicsMesh()

Official documentation on it is here, but to be honest I don't understand all of what's written there. For example, it seems that arguments are optional, but are they optional in my case? Not sure.

I tried writing a simple script for this, but I believe my syntax is wrong because the player object does not fall through the trap door, and as you can see from the physics debugging visualization, the physics mesh is not updating.

Logic:

enter image description here

Script:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

char_coll = cont.sensors["CharColl"]

if char_coll.positive:
    print("Character collision detected")
    own.reinstancePhysicsMesh()

.blend file added.
Source Link
Mentalist
  • 19.4k
  • 9
  • 98
  • 172
Loading
Source Link
Mentalist
  • 19.4k
  • 9
  • 98
  • 172
Loading