player interaction and bullets - physics

Help and examples in this topic, there is free and extended help on BGE.
---------------------------------------------------------------------------------------------------------

Hi there.
Here is an example of an animated cylinder with bones - test_anim.blend (489 KB)
But when you play the animation ( squatting, space bar), the physical bounds of the cylinder do not change - both in interaction with bullets and the beam.
How then to solve the problem of exact hit of a bullet in the player - an arm, a body or a head after squatting or change animation?
I mean - is it possible for physics to interact with animated bones by the player (the model itself), without additional objects?
You can also move the “player” with the keys - DA.

Thank you for attention.

Tried using this: https://docs.blender.org/api/blender_python_api_current/bge.types.KX_GameObject.html#bge.types.KX_GameObject.reinstancePhysicsMesh

edit: removed nonsense

  • OK man. Job well done. Several characters per line - own.reinstancePhysicsMesh() - and a miracle happened, the green mesh now crouches.
    And of course, it’s best to use separate objects to detect bullets - it’s easier to create a system of injuries and disconnections when a bullet hits - arms, legs …
    Thank you for your help.

Did it work for you ?

I was using BFBGE, wonder if UPBGE supports this.

edit: I can’t seem to get it to work here…

  • docs.blender.org - this is the Blender reference - that is, everything that is described, everything works. There really are nuances with a mesh, it is highlighted in red.

Can you then send the working blend ?

If so, tell me which version of the BGE you used, because from the few tests I made it didn’t work. I surely did something wrong.

  • with my frozen brains, it often happens :yes:

test_anim.blend (495 KB) Blender 2.79

There is really a problem with triangles (collision bounds) - bullets often fly through the model. But the sensor “ray” is triggered.

Thank you very much !

Ok so you update the physics mesh, but the collisions bounds have to be in “triangle mesh”, ok !

edit: yea I just realized that I didn’t read the doc I sent. I should’ve. Everything is written in there once again lol

  • for which I grateful? You gave me the link, and there is a simple line (code) with an explanation.:eyebrowlift2:.
  • there it is indicated in the description that there is a load on the system, when scanning the mesh - so probably it will be more correct - test_anim.blend (499 KB) - Now the mesh update turns on if the [“prop”] > 1.

Thank you for attention.

Quick warning: Reinstance physics mesh is very processor heavy. On a modern i7 you can only reinstance about 2000-4000 polies per frame before you start getting lag.
For physics hit-detection it is better to use smaller non-deforming shapes parented directly to the bones. Of course, this will need lots of collision logic bricks (or in python: linking all the collisionCallbacks)

  • of course man, we knew about it … we almost knew :D.
    Thank you for the information.

test_animDiceTable.blend (502.4 KB)
I went ahead and add a randomize function so as to mimic game dice tables. If the player is wearing armour there is 1 in 3 chance it will penetrate the Armour. I also change the collision bound.

OK :sunglasses:, but I still do not find myself applying this … just probably I have now other interests so far … go smoke, or what ? in “Holland” :yum: … Of course it’s a joke.