NVIDIAGameWorks / PhysX

NVIDIA PhysX SDK
Other
3.11k stars 793 forks source link

Looking for guidance on triggers, and in general (enemy bullets hitting player ship) #638

Open PcChip opened 1 year ago

PcChip commented 1 year ago

Hello,

Image here to set the stage: https://i.imgur.com/JXkbSMX.png
In the image, a turret shoots kinematic trigger balls towards the player, which is a character controller (very skinny in this screenshot) and another shape that is the shape of the ship to notify when bullets hit it

TL;DR - I'm looking for some guidance in general on the following: How should I treat enemy and player bullets, the character controller, and the shape of the player's ship? Since the CCT does not match the shape of the ship, I do not want bullets to interact with the CCT Capsule Shape in any way!

I'm using a character controller so that I can have collisions with the terrain, and enemy buildings. However, it doesn't fit the shape of the player ship perfectly, so I'm trying different methods to make a shape to catch bullets... I've tried:

The problems I'm having is the following: I cannot figure out a combination of actors/shapes/flags to make my goal work. (the shapes either interact with each other and push each other away, or don't interact at all and do not cause a trigger callback or collision callback.) I just need a character controller to collide & slide with the ground, and a shape for the ship to notify when bullets hit it!

Should I use kinematic objects for the bullets? Trigger shapes?
Should I use a kinematic object for the "shell" of the space ship?

= New Trigger Method (Simulation Filter version) =
I also tried making both triggers, but they would not interact. That's when I found @PierreTerdiman 's posts on the Unity forum explaining why those were deprecated, and saying that people should be using newer methods (included in TriggerSnippets), so I began trying that as well. I'm having several problems with that method:

Thanks for any help you can provide, I'm just feeling really confused on all the possible options and can't seem to make any of them work for what I'm trying to do!