playMaker

Author Topic: Spawn Hitbox to Trigger Attack Collision  (Read 2338 times)

Knuckleup

  • Playmaker Newbie
  • *
  • Posts: 14
    • Sugarhigh Shakedown Dev Blog (A love letter of tragedy to beat em ups)
Spawn Hitbox to Trigger Attack Collision
« on: May 19, 2018, 12:54:23 AM »
I created an Empty Game Object. Gave it a Circle Collider2D Component. Checked Is Trigger.  I positioned and rescaled it to cover the boxing glove of the frame I want it to Spawn at.  Noted the x Position. Made it a prefab.  Opponent has a Box Collider 2D.

I have both the Right/Left Punch animation firing with corresponding Keys (Picture Nes’s Punch Out as that is what I’m doing a test run on) via Playmaker FSM.

Animator: Parameter - Trigger (Punch).

FSM - In the State the Punch fires, I tried adding Get or Create Object: Dragged the
“Hitbox” Prefab into the slot.  I also tried using a Varable called Punch.  I tried Spawning the Prefab at the X Position. 

Gave Opponent a Collision FSM and did a few states to try and make connection detection and for now trigger opponents getting hit animation.  Worry about health later.

Anyone have a better FSM setup with specific actions that worked? 

Thanks.





djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Spawn Hitbox to Trigger Attack Collision
« Reply #1 on: May 20, 2018, 06:34:23 PM »
Hi,
I Can't really follow your explanation so bare with me if this does not help :)
 
Maybe you can place the colliders permanent and then just disable/enable the colliders with this action : Enable Collider


Wolfride

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Spawn Hitbox to Trigger Attack Collision
« Reply #2 on: May 20, 2018, 06:46:20 PM »
If there is no actual physics involved, and you have set animations for what happens when hit, you can have multiple colliders parented to the object in motion. Then use a trigger collider that fires the FSM for changing the animations. You can also apply physics in the same state if you wish for them.

Edit: You would want a global transition from that trigger hitting a tagged non trigger collider on the opponent. That way it goes STRAIGHT to that FSM.

At least it's one way of doing it.