Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: gearedgeek on November 15, 2016, 02:10:13 PM

Title: Projectile Collision[SOLVED]
Post by: gearedgeek on November 15, 2016, 02:10:13 PM
I have followed this tutorial to set up the collisions for the projectiles in my project. I'm using the weapons from Third Person Controller by Opsive. I have added the Exploder asset to make GameObjects to explode into pieces. I have managed to get the melee collisions working like from the video. Here are screenshots of what I have done.

https://postimg.org/image/wrs8b3827/

https://postimg.org/image/9rlkyra8f/

https://postimg.org/image/bxfvt9dov

https://postimg.org/image/tori7pt3j/


From what I can tell is that the bullet projectile is spawned when the weapon fires. I can view in the editor the bullet projectile flying through the scene. The collision is working because I can push a game object such as a crate with the bullet projectile. I can't get the playmaker actions working when the bullet projectile is spawned.
Title: Re: Projectile Collision
Post by: jeanfabre on November 16, 2016, 03:52:28 AM
Hi,

 "meleehit" event has to be a global transition, it has to sit at the top of the state, OR be a transition of the active state at the time of call.

 Bye,

 Jean
Title: Re: Projectile Collision
Post by: gearedgeek on November 16, 2016, 04:26:00 AM
The "MeleeHit" has the box checked in the event tab of the crate prefab. When the Katana enters the collision it sends the MeleeHit event to the crate prefab. I have the bullet prefab set up the same way but it seems like the send event isn't working or the collision isn't happening.
Title: Re: Projectile Collision
Post by: jeanfabre on November 17, 2016, 02:41:33 AM
Hi,

 I mean a global "Transition", that sits at the top of the state, not the bottom, not to be confused with global event.

(http://i.imgur.com/LRfHsAJ.png)

 Can you try like that?

Bye,

 Jean
Title: Re: Projectile Collision
Post by: gearedgeek on November 17, 2016, 03:03:11 AM
I see. I have changed it around to look like what you posted. I have also been watching the FSM Log when testing. When the projectile prefab collides with the crate the FSM doesn't move out of State 1.
Title: Re: Projectile Collision
Post by: jeanfabre on November 17, 2016, 03:14:57 AM
Hi,

 then it's your physics setup.

 have you drop a RigidBody on both GameObject with colliders?

Bye,

 Jean
Title: Re: Projectile Collision
Post by: gearedgeek on November 17, 2016, 03:20:31 AM
Yes, both GameObjects have the RigidBody component attached.
Title: Re: Projectile Collision
Post by: jeanfabre on November 17, 2016, 03:22:43 AM
Hi,

 ok, then start a new scene, with two cubes set to collide at some point under gravity or else, and have a simple fsm with just a global transition ON COLLISION ENTER.

if that works, then you'll need to go back to you other scene and figure out what's not exactly right.

 Please confirm the test scene as described above. Always double check a feature in its most isolated environment before fixing a bug like that.

Bye,

 Jean
Title: Re: Projectile Collision
Post by: gearedgeek on November 17, 2016, 03:59:30 AM
I'll start a new scene and see what happens.

I know the collision is working because I have a melee weapon using the on collision enter and it works fine.

https://postimg.org/image/tori7pt3j/

Since the collision wasn't working I was going to try making a FSM on the pistol to send the event when the player fires the pistol. Just in case, how would I go about doing that?

Title: Re: Projectile Collision
Post by: jeanfabre on November 18, 2016, 02:03:01 AM
Hi,

 The first thing is maybe to move the COLLISION ENTER as a global transition instead of a regular transition.

I am not sure I understand where the difficulty is on your idea of sending an event when the player fires. Where do you struggle implementing this?

Bye,

 Jean
Title: Re: Projectile Collision
Post by: gearedgeek on November 19, 2016, 07:26:07 AM
Here is the FSM. I have also added the Collision Enter as a global transition and it sends the event per the FSM Log. But the crate doesn't receive the command it seems.

https://postimg.org/image/bz4iunhjj

https://postimg.org/image/r94e1ud1r
Title: Re: Projectile Collision
Post by: gearedgeek on November 20, 2016, 12:06:39 AM
I finally figured out what the problem was. I'm using the Third Person Controller from Opsive. The projectile script adds the option to destroy the projectile on collision. That option was checked so the FSM was not able to run because the projectile was destroyed.

Anyway, the FSM is now working correctly. Thank you for the help.