playMaker

Author Topic: Performance of Collision Event  (Read 4050 times)

dasbin

  • Junior Playmaker
  • **
  • Posts: 92
Performance of Collision Event
« on: August 13, 2012, 04:51:10 PM »
Hi,

Is there a performance cost for using multiple Collision Events in a single State? More so than just one?

I am checking for collisions against multiple tags (10 or more) simultaneously, and firing different events based on what is hit... all on many instances of the object. Is this a potential performance problem? Would it be better to write custom Actions that check for multiple tags in the same action?
I don't own Unity Pro so I can't profile the cost.

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Performance of Collision Event
« Reply #1 on: August 13, 2012, 05:09:14 PM »
Hi,

 As long as it is not a "STAY" type of collision or trigger events, you will be fine with any number of collision events checking in terms of performances,

now... I have a project doing such things, and I have to say I did had some problems, I never found the real sourc e of the problem, but I suspect it is because I use too many collisions check in one state ( I might be wrong tho..) but basically, I started experiencing some corrupted debug flow content, where for a given collision event, playmaker would start loosing its babies and say that a given fsm sent that event, even tho that particular fsm does not even send an event to begin with, so it was clear some pointes issues arised.

 so I would really do a FSM per collision detection, I reached 5 6 collision event detection action, and that was ok, but I would not go for more. But Iw as using a lot of tags, weird complex physics set up, mixed colliders, concave convex, etc etc... I ended up splitting my colliders into smaller more discrete and simple volumes to overcome this.

bye,

 Jean

dasbin

  • Junior Playmaker
  • **
  • Posts: 92
Re: Performance of Collision Event
« Reply #2 on: August 13, 2012, 05:29:07 PM »
Interesting.

Unfortunately, some of the detection does have to be "STAY" type for various reasons. I will try to minimize the number which are.

The other issue I've run into is that "STAY" are actually not triggered as quickly as "ENTER", and the collision can actually be missed if there is only "STAY" detection. (Objects will bounce off each other without ever triggering the FSM's "STAY") This forces me to detect both "STAY" and "ENTER" for the same object, to be sure the collisions are caught, which I can't imagine is very good for performance.