Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: SawyerK on June 05, 2021, 12:53:36 PM

Title: Collision Event cannot be used with variable Game Object
Post by: SawyerK on June 05, 2021, 12:53:36 PM
I use Collision Event to detect a collision on a picked up object so it doesn't go through the ground. The first thing that i pick up, it works well, but if i pick up another object it detects collisions on the previously held item, even thou the debugger says its the new item. What could be the problem here?

Works great with the first item. Item collides with the ground event goes to the "collided" state.
(https://i.postimg.cc/tJshxngd/collision1.jpg)
Second item being pick up, the variable says "repairbox_medium_1" wich is the item that im holding currently but doesn't collide
(https://i.postimg.cc/fy1YjW3G/collision2.jpg)
Instead it detects the collision on the previous item.
(https://i.postimg.cc/hjyLv1KP/collision3.jpg)
 
Title: Re: Collision Event cannot be used with variable Game Object
Post by: djaydino on June 06, 2021, 08:28:08 AM
Hi.
on pickup. try to move out from the state with the collision action and go back to after the object is changed.
Title: Re: Collision Event cannot be used with variable Game Object
Post by: SawyerK on June 06, 2021, 02:26:09 PM
I don't think I understand what you mean.
Title: Re: Collision Event cannot be used with variable Game Object
Post by: djaydino on June 06, 2021, 08:07:42 PM
Hi.
If the State with collision action is active and you change the object it will not work.
as its not checking the object every frame (so the action thinks it still using the previous object).
if you change state after changing the object then go back to the state with the collision, it might work.
Title: Re: Collision Event cannot be used with variable Game Object
Post by: SawyerK on June 07, 2021, 07:55:30 AM
It does change the state. It does not change the object while the collision action is active, it changes after it in the beginning "notHold" state. I made a video how it works.
Title: Re: Collision Event cannot be used with variable Game Object
Post by: djaydino on June 22, 2021, 08:36:59 AM
Hi.
Maybe do the collision checking on the objects and set a bool
Then use a 'Fsm Bool Test' on the 'is holding' state.

Another thing you should also try before this is to change 'Collision Enter' to 'Collision Stay'