playMaker

Author Topic: Newbie Question: Collision detection, Machine Guns and You. [SOLVED]  (Read 4546 times)

Red

  • Hero Member
  • *****
  • Posts: 563
okay... i'm trying to get an enemy cubie to detect when it collides with a bullet-spark prefab that's created and does not move (giving the impression that the gun firing is firing too fast to see) and thought that it would work for telling the monster (an Evil Cubie) when it's hit so that it can subtract the appropriate amount from it's health... and once down to 0 it's to destroy itself. the FSM seems to get hung up on detecting the collision if it's anything but a custom tagged item (i'm using a tag "damagers" for the prefabs being created where the bullets hit.)

it detects player and untagged (haven't tried other enemies) but not "damagers."

any hints on how to get my characters minigun to do damage? i don't mind scrapping what i have so far (though i would like to keep the bullet sparks where it hits, but afaik that's purely cosmetic.)
« Last Edit: November 05, 2011, 03:06:07 PM by alexchouls »

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #1 on: October 20, 2011, 02:40:25 PM »
Hi. You gave a little blurry info here. One of the things that matters here - is what actions do you use to handle this actually.

Ever tried doing raycasts?
Those are a best/only choice when it comes to weapons that shoot very fast moving bullets.
« Last Edit: October 20, 2011, 04:50:13 PM by Andrew_Raphael_Lukasik »

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #2 on: October 20, 2011, 04:13:37 PM »
i've tried but don't really know how i'm going to pass the information on to the monster so that it can calculate the damage. one workaround i have considered was to make the variables global but then that would mess up the other monsters not taking damage afaik.

as for the action i'm using, it's the "Collision Event" action.

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #3 on: October 20, 2011, 04:59:35 PM »
Maybe it helps - I used to handle these things by simply doing:
Raycast >> Store Hit Object as X >> SendEvent "Apply Damage From Minigun" to X

PS: Of course object X need to have global event "Apply Damage From Minigun" connected to states that handle calculating that damage.

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #4 on: October 20, 2011, 08:11:34 PM »
okay, next question... global events? can't find anything in the event browser that would let me know if it's global or local... can you show me where i can create and/or make an event a global event? do you mean global transitions?  ???

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #5 on: October 20, 2011, 08:55:08 PM »
What version of PM do you have?
PM1.1 dont have global events, but it's ok - just use <SendEventToFSM> instead then

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #6 on: October 20, 2011, 09:23:56 PM »
i've got "Send Event" but that doesn't help me with not really understanding what you're meaning with "global events."

please clarify... do you mean a global transition using an event? if so, any idea why i'm not able to see it when i try and tell the "send event" or the "send event to fsm" action?

as for the version, it's 1.2.1

Oh for the love of... found it... it's the checkbox right at the left of the name... (now i feel like the uber-newb.)

Thank you for having patience!
« Last Edit: October 20, 2011, 10:22:22 PM by Red »

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #7 on: October 21, 2011, 05:59:59 AM »

Great Success! :D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #8 on: October 21, 2011, 06:51:18 AM »
nice one :) Quit a shock to see him there...

Andrew.Lukasik

  • Full Member
  • ***
  • Posts: 134
    • my twitter @andrewlukasik
Re: Newbie Question: Collision detection, Machine Guns and You.
« Reply #9 on: October 21, 2011, 11:21:30 AM »
This is precisely what he do :)