Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Red on October 20, 2011, 11:40:22 AM

Title: Newbie Question: Collision detection, Machine Guns and You. [SOLVED]
Post by: Red on October 20, 2011, 11:40:22 AM
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.)
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: Andrew.Lukasik 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.
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: Red 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.
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: Andrew.Lukasik 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.
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: Red 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?  ???
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: Andrew.Lukasik 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
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: Red 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!
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: Andrew.Lukasik on October 21, 2011, 05:59:59 AM
(http://img.thesun.co.uk/multimedia/archive/00141/F_200612_december14_141299a.jpg)
Great Success! :D
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: jeanfabre on October 21, 2011, 06:51:18 AM
nice one :) Quit a shock to see him there...
Title: Re: Newbie Question: Collision detection, Machine Guns and You.
Post by: Andrew.Lukasik on October 21, 2011, 11:21:30 AM
This is precisely what he do :)