playMaker

Author Topic: Collider 2D event with a Controller that has no Rigidbody2D Component  (Read 1805 times)

christianstrang

  • Playmaker Newbie
  • *
  • Posts: 16
Hi guys :)
I created a FSM that acts as a controller. You can drag & drop objects (which works fine) and if you hit a similiar object (based on tags), those two fuse into a new object. The fusing part worked when I had it implemented on the individual objects as FSM's but I refactored it all into the controller FSM to avoid duplicate code and let me manage it easier.

My problem is: if I use the "Collision2D Event" action, it only works with a Rigidbody2D Component attached, but the FSM I'm using just acts as a controller. Is it somehow possible, to adjust the collision2d event to use a specified gameobject, instead of it implying that the gameobject, that has the fsm attached to is, is the object that I want to check collision against?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Collider 2D event with a Controller that has no Rigidbody2D Component
« Reply #1 on: August 10, 2016, 05:11:27 AM »
Hi,

 very good questions, it's currently internaly discussed on how this can be achieved.

 so indeed, currently, you can only get collision system events on the gameobject it occurs. If you want to decouple, you could have a template that fires an event to your framework and you can catch it like that, avoiding to implement the specific logic on the gameobject itself.

Bye,

 Jean


christianstrang

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Collider 2D event with a Controller that has no Rigidbody2D Component
« Reply #2 on: August 11, 2016, 08:15:37 AM »
Actually, in my specific case I didn't really need this advanced system, though it would definitely come in useful, specifically to reduce the number of FSM's being used and code duplication.
Is there a limit on how many FSM's one should use on mobile, or does it mostly depend on how much activity each FSM has?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Collider 2D event with a Controller that has no Rigidbody2D Component
« Reply #3 on: September 12, 2016, 05:56:36 AM »
Hi

 Indeed it depends on what the Fsm do in the active states, so you can certainly have a lot of Fsm.

 on mobile, your struggle is graphics, so I would first make something that works and then profile and optimize, it always better than trying to optimize a game that isn't finished, chances are you'll be optimizing features that are not final and it will be very difficult to modify it.

Bye,

 Jean