playMaker

Author Topic: Moving trigger doesn't detect enter/exit  (Read 2943 times)

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Moving trigger doesn't detect enter/exit
« on: April 21, 2014, 07:33:23 PM »
I have an enemy with a "field of view" cube in front of him. It's basically a sideways pyramid shape. When the player enters the field of view, the enemy starts to follow etc. However, if the player stands perfectly motionless, and the enemy's field of view moves to collide with the player, nothing happens. If the player even taps to move the teeniest bit, it will update and the trigger will send the event.

I remember reading somewhere that triggers don't work if they're the mobile object - they only "listen" for other objects moving into them.

Is there a way to circumvent this? I have my enemy AI working pretty nicely, except for this little issue. Since my enemies aren't velociraptors, I don't want my player to be able to avoid detection by remaining still (although that would be a neat game idea) :D

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: Moving trigger doesn't detect enter/exit
« Reply #1 on: April 23, 2014, 07:05:04 PM »
Temporarily solved by nudging the character object by a microscopic amount every frame with the "translate" action - tricks the collider into thinking the character "moved" even when stationary.

Obviously not ideal, but a quick and dirty fix to get the job done. Wondering if there are any other solutions out there?

billsclass

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Moving trigger doesn't detect enter/exit
« Reply #2 on: April 24, 2014, 03:07:16 PM »
I found Triggers and Collisions to be a little tricky depending on what is moving/still and what is RigidBody vs Collider.

My work around has been to use System Events (Collider or Trigger Enter) when things are not responding the way I want with the Physics > Actions.

-B


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Moving trigger doesn't detect enter/exit
« Reply #3 on: April 24, 2014, 03:15:30 PM »
It could be the collision detection type. For optimization there are several types of collision detection.

http://docs.unity3d.com/Documentation/Components/class-Rigidbody.html

Discrete
Continuous
Continuous Dynamic

Try changing that and see how it acts.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: Moving trigger doesn't detect enter/exit
« Reply #4 on: April 24, 2014, 08:06:04 PM »
Bill, I'll give that a shot!

Lane, weirdly my character (the one "tripping" the trigger) doesn't have any rigidbodies on him, so I don't have the option to change that variable. I recall you saying in an earlier post that in order to work with "trigger event", you need a rigidbody on whatever is setting it off, but my character has no problem interacting with triggers (except for this current one which moves). Did I break something if  my triggers work without a rigidbody on my character?  :o