I am having some trouble in handling(and detecting collisions). For instance, I want my gameobject’s collider-trigger to be turned off whenever I collide with a gameobject - say with tag = ‘‘A’’. So basically I want such collisions to be detected explicitly (like I want all collisions-physics and other stuff to work)
However I want gameobjects with tag, say “enemy” to pass through my player gameobject, but while they collide my health should kind-of decrease…
I tried to turn the collider-trigger on, but then I noticed that this basically turns off coliisions altogether…like enemy gameobjects can definitely pass through me but then my health does not decrease…And am clueless as to how to detect explicit collisions with some specified gameobjects as I mentioned, with tag=“A” and simultaneously have the enemy-objects pass through me without “colliding” in the real sense.
I haven’t worked with such collisions in the past, so a bit of help is needed.
This is not what I want. See I have rigidbdies attached (they can’t be turned off basically) to both my enemy and player spheres. Now I want my enemy sphere to pass through my player sphere (and not get reflected following the physics of collisions)…whenever this happens my playerhalth will decrease, but both my player and enemy spheres should detect collisions with other gameobjects(and follow related physics of collisions), like, with gameobjects having tag=“A”…
Thank you for the link…but as I said the enemy sphere should pass through my player sphere but at the same time, I want to decrease my playerhealth while the enemy sphere is still “inside” my player sphere…
You could put a collider on the enemy, turn of the player in the collisions matrix, add a child game object with a trigger, then on the player script detect if the trigger gameobject is a child object of the enemy