playMaker

Author Topic: Play Animation When 2 Character Simultaneously Enters Trigger [SOLVED]  (Read 2766 times)

akira

  • Playmaker Newbie
  • *
  • Posts: 8
Hi All.
First of all, sorry for my English. It’s been 3 days I’ve tried to solve this problem and finally decided to ask around for help. I have two characters (A and B) in my game that are controlled by the same controller. Point 1 and Point 2 is the trigger. Take a look at attached images for a better explanation.



Here is what i wanted to achieve:



1) I want the door to open when my players enter those points simultaneously. No matter whether A on point 1 and B on point 2 or vice versa.

2) How can i make my characters passing through each other with a rigidbody2d on?


« Last Edit: May 19, 2014, 09:47:14 AM by akira »

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Play Animation When 2 Character Simultaneously Enters Trigger
« Reply #1 on: May 15, 2014, 05:14:19 PM »
Hello,
Is this inspired by brothers??? Anyways, down to the nitty gritty.

1. You can set up a bool system for the player being over it, so basically what you have to do is set both players to have the same tag, then have the action that say on trigger event soooo that when player enters trigger turn bool ON or 1, when player exits trigger turn bool to 0. THEN you need another FSM that is checking to see if both buttons are set to 1 = open door.

Advice: take a look at all the actions carefully because you will see that there are always better ways to do something!

2. For this you need to set both characters into the same layer, then in the physics tab under the edit menu (i think, I'm not in front of unity) uncheck the layer to collide with itself so there will still be collisions with other objects but not with anything in the players new layer.

Cheers!
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

akira

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Play Animation When 2 Character Simultaneously Enters Trigger
« Reply #2 on: May 16, 2014, 01:30:45 PM »
Hi Sebalsive,

Thanks for your reply.

Brothers?? I just knew the game from you..hehe..

1) I still can't solve the problem..I tried setting the bool value for both players, set target event and everything..but still cant find the solution. Can u help me by giving more detail bout how and where to put the bool value and FSM? maybe i do it wrong..

2) Thanks for your help bout this rigidbody problem..its solved!

akira

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Play Animation When 2 Character Simultaneously Enters Trigger
« Reply #3 on: May 18, 2014, 12:55:53 PM »
Anyone care to help me here? Still stuck on the same problem.. =(

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • My Blog
Re: Play Animation When 2 Character Simultaneously Enters Trigger
« Reply #4 on: May 18, 2014, 06:35:17 PM »
I'll put together a basic project. Just give me a few minutes.  ;)

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • My Blog
Re: Play Animation When 2 Character Simultaneously Enters Trigger
« Reply #5 on: May 18, 2014, 06:44:34 PM »


I tried to keep things generic. Normally I'd prefer to use some ArrayMaker magic to add an unlimited number of inputs/buttons, but this does what you need.



I prefab'd it up and added public/inspector variables so you could plug in whatever buttons/inputs you need. With a little bit of playing around, you could add switches/levers as inputs too.

The door opening is a simple tween. You could add button exit logic to close the doors again. Just do everything in reverse.  ;)

EDIT: Woops forgot to attach. Here we go!

akira

  • Playmaker Newbie
  • *
  • Posts: 8
Thanx a lot TrentSterling!! You're a lifesaver!!  ;D

I can now move on to next phase!! Owh finally....

Many many thanx!!   :D