Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: spiralKing on May 12, 2013, 04:02:50 PM
-
I have 2 objects, the PC and the NPC, both objects are using a Character Controller
when the PC hits the NPC, the collision is not being detected, well the NPC isn't going through the PC, but the event that's supposed to be triggered isn't being triggered
I'm using the Collision event action, and for collision I'm using On Controller Collider Hit
it's like I'm saying when object hits the floor, destroy object, but object is only hitting the floor without getting destroyed
-
Hi,
-- Have you messed with physics layer settings?
-- Are you really using "Colliders" everwhere, not "triggers", there is a difference, both are collider components, so it can get confusing.
-- try to use the global event "ON COLLIDER ENTER", if that works, then it's your action set up that is not correctly set.
bye,
Jean
-
Have you messed with physics layer settings?
don't think so, where do I find the physics layer settings?
Are you really using "Colliders"
I'm using a Character Controller, and as far as I know, it comes with it's own collider, but not the option to turn it to trigger
try to use the global event
I'm asuming you mean in the Collision event action, in collision
I changed from "On Controller Collider Hit" to "ON COLLIDER ENTER", I'm still getting nothing
-
Try adding rigidbodies to each and making them Kinematic.
-
I guess rigidbodies could work, but my setup is meant to work with a character controller
If I switch to rigidbodies, I'd have to retrace my steps and make many changes
-
Make it kinematic and ignore gravity and see if it fixes the issue. You're not applying any physics forces so it shouldn't be any impact to your design.
-
damn, yea, didn't work
thanks for trying
-
Can you post a screenshot of the on collision event state?
-
how do I add images here
-
never mind
-
The NPC Attacking tag is probably the problem.
The collision tags are meant for the collider shapes, the object that you have the collider on needs to be tagged "NPC Attacking", the tag option in the top of the inspector, left of the Layer selection drop down list. Also confirm that the object on the player that has the collider component is tagged "Player".
Generally I would just use the collider of the NPC, and in which case I dont know why it would ever be called NPC Attacking unless the NPC is constantly wailing a sword through the air.
I dont think the collision is ever happening, according to the engine.
-
my NPC has a few states, it follow (tagged following), it gets into readying mode (tagged readying), and when it actually attacks, I used the tags to make it so that the PC can only be hurt when NPC is actually attacking
The PC is tagged "Player", and the Attacking tag is on the NPC, it switches tags depending on the state
anyway I'll give the tag idea a try, I'll also try Debug to see if collision is happening
-
Faced exact same problem. Has anyone found a solution?
-
Faced exact same problem. Has anyone found a solution?
It looked like he was using Tags to define the state of the NPC for some reason and the colliders were not detecting the collision because the tags didn't match. Tags shouldn't really be used in that manner.
-
I'm running in to the same issue. Once a Character Controller is added to an object, the collision events don't seem to work. I'm not sure if this is how Unity handles Character Controllers or if this is a PlayMaker.
Collisions Events work just fine in various scenarios including,
RidigBody vs RigidBody
RigidBody vs Collider (non RigidBody)
RigidBody falling on Character Controller Collider
Once a Character Controller is added to an object (with or without Rigid Body) Collision Events will not fire when initiated by the object with Character Controller.
Throw a RigidBody object at the object w/ Character Controller and you can get an event to fire.
System Event > Control Collider Hit seems to work, but there is not way to efficiently check continuously and filter by tag.
The only work around I've come with is to use Trigger Events instead of Collision Event. You will have to run into an object with Collider set to Trigger.
In the case of two objects with a Character Controller, you'll need a child object with a Collider set to Trigger to fire events.
Anyone else have a solution?
-AB
-
https://docs.unity3d.com/Documentation/Components/class-CharacterController.html
A Capsule Collider is included in the Standard Character Controller Component. You don't need to add additional ones and that probably confuses the controller.
This is very likely the problem.
-
Thanks, Lane.
I don't think I doubled up the colliders. For some reason when using a Character Controller, the object using the character controller can not initiate a Collision Event, only a Trigger Event.
In other words, if I shoot a rigidbody object at my character controller object, I can detect a collision using Collision Event on the "projectile" object.
If I set the "projectile" on the ground or suspend it in the air and run into it with a character controller collider, the bullet will not detect the collision nor will the character controller object detect a collision. This leads me to wonder if character controllers can only receive collision and not initiate a collision.
Another way of putting is,
Drop a rigidbody cube on the "Player" = Collision Event
"Player" jumps on the same cube ≠ Collision Event
Controller Collision Flags fire in the above scenario, just not a collision event.
I'll build a sample scene that demonstrates. Maybe there is some conflict I am creating with my Playmaker/Physics logic.
Thanks again for the input.
-
Hi,
not aware of any. I use the same technic as you mention, a child of the character controller.
bye,
Jean