playMaker

Author Topic: Blender model and OnTriggerEnter and Exit Problem  (Read 4129 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Blender model and OnTriggerEnter and Exit Problem
« on: August 20, 2014, 03:10:06 AM »
Hi,

I have imported a blender model into Unity and have setup a OnTriggerEnter and OnTriggerExit on this model.

The problem is when the player enters it works for a second then it thinks its exit the trigger. This keeps happening every second in a loop when moving inside the model (trigger). Strange? any ideas why?

ive attached my setup, including the inspector options on my imported model

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #1 on: August 20, 2014, 11:23:27 AM »
Try making a custom event other than FINISHED. As a system event, you have to be careful where you use it. Normally I make a "done" event so I have more manual control.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #2 on: August 20, 2014, 06:14:00 PM »
Hey,

I have tried changing the event from FINISHED to DONE and it hasnt worked. Now, when it enters the trigger it loops 2/3 times and then it stops looping. confused now :/

when i re-enter the trigger it behaves the same again.

anything else i can try?

Nick
« Last Edit: August 20, 2014, 06:31:24 PM by coxy17 »

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #3 on: August 21, 2014, 05:24:20 PM »
Hi,

i just enabled 'convex' in the inspector on my imported model and it works!!? as enabling this changes the shape of my model, i cant use this. Is this a bug with Blender models?


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #4 on: August 21, 2014, 05:52:23 PM »
Maybe if you're using a Mesh Collider, I think thats the only time it actually cares about the mesh being convex/concave... I think.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #5 on: August 25, 2014, 10:19:21 AM »
Hi, yes its a mesh collider. Seems like ive got no other choice but my trigger is basically a 3d cross. When I make it convex it changes the shape into a diamond. So its no good. I need the shape to stay as a cross. Grrrr

this is a crap feature.

out of ideas

oh well

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #6 on: August 25, 2014, 11:14:36 AM »
Just add two box colliders instead. You can create a bunch of primitive shape colliders to make more complex shapes.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #7 on: August 25, 2014, 12:48:28 PM »
if i create 2 box colliders then can i combine them to the same parent and have the script for ontriggerenter on the parent object? or do i have to put the FSM on each box collider?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #8 on: August 25, 2014, 01:51:13 PM »
Unity makes them Compound Colliders automatically, check the Rigidbody section of the manual out, under the Compound Colliders section.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #9 on: August 25, 2014, 05:55:42 PM »
ive taken a look and have tested but with no luck. having physics on my parent causes it to not work when colliding? it completely ignores the trigger.

So from my understanding, i have setup and game object and added box colliders as children. Then added physics to the parent object and selected isTrigger on all children too.

is this right? sorry if not. still learning.

Nick

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #10 on: August 25, 2014, 08:35:18 PM »
Yeah, I looked around on the unity forums and it doesn't seem like you can make a compound trigger. Weird, not sure why that is the case. Ran a quick test and it didn't seem to work.

Compound colliders are fine, a rigidbody can collide with a group of colliders on different gameobjects but it doesn't look like triggers can be setup that way. Triggers only seem to consider that particular gameobject, and arent automatically compounded from the child objects like regular colliders are.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Blender model and OnTriggerEnter and Exit Problem
« Reply #11 on: August 26, 2014, 02:59:20 AM »
Ok thanks alot for your help anyway. I guess its a mystery.

oh well, will have to try and alternative :/

Nick