playMaker

Author Topic: Destroy one object destroyes them all  (Read 1462 times)

Jor

  • Playmaker Newbie
  • *
  • Posts: 4
Destroy one object destroyes them all
« on: February 13, 2020, 11:52:04 AM »
Hi there,

I'm making a game where you have to clean up dirt. The sweeper has two brushes, left and right.
I made some objects for the dirt (as it's testing it's just planes). I followed a few tutorials but when ever i do as they say i run into the problem that once my brush hits the plane, all the planes disappear instead of just the one.
Not sure what i'm doing wrong. I used coin collecting tutorials where a player hits the coin and collects it, then having a few coins copied onto the map and they disappear only when the player touches them.
In my cause the player is swapped for Brush left or Brush right. I also used a cylinder at one point to see if that worked.

It's setup like this:

State: Dirt
Trigger event  - Specify game object "Brush R", Trigger "on trigger enter"
, Collide tag dirt (tagged the dirt plane with the tag dirt), send event "remove dirt"

->

State: Dirt cleaned

Destroy self

Anyone know what i done wrong?

Screens of how it's set:

https://ibb.co/WGmwJ9Z

https://ibb.co/19v233S

https://ibb.co/52FKJP9

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Destroy one object destroyes them all
« Reply #1 on: February 13, 2020, 02:44:39 PM »
Hi,
I think its better to have a 'trigger event' (set to on trigger stay) on sweeper (one on each brush)
Then store what you trigger (dirt) then destroy the stored object.

(later its best to use pooling instead of destroying)

Jor

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Destroy one object destroyes them all
« Reply #2 on: February 13, 2020, 03:40:25 PM »
How can i approach this the best way. I'm rather new to it all. I followed a tutorial on udemy but that guy only spoke about destroying an enemy. When it came to the coins he made them vanish. But those techniques didn't work for me without them all dissappearing.

I tried to find video's how to do the pooling thing, but i only get video's of how to shoot bullets and create things instead of making them vanish.

I did create a FMS on the right Brush - Trigger event: Gameobject "use owner", Trigger "On trigger stay", Collide tag "dirt" then i see the store collider but it asks for variables. What can i do best or what would be a good tutorial for me to follow in this regard?

Thanks.

Jor

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Destroy one object destroyes them all
« Reply #3 on: February 16, 2020, 01:29:33 PM »
I got it to work now, thank you for the sugestion. Found a tutorial about bullets that did the same with pooling :) Thank you so much!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Destroy one object destroyes them all
« Reply #4 on: February 16, 2020, 01:39:23 PM »
Great :)

was it this video by the way ?


Jor

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Destroy one object destroyes them all
« Reply #5 on: February 17, 2020, 01:57:38 PM »
I followed one on the Hutong channel itself, but this one looks interesting too.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Destroy one object destroyes them all
« Reply #6 on: February 20, 2020, 05:12:17 PM »
Hi.
Can you give a link to the video you watched :)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Destroy one object destroyes them all
« Reply #7 on: February 24, 2020, 10:59:55 AM »
Looks like you are trying to destroy The One Ring.
j/k

Are you sure you don't fire your event to all dirt objects? Like 'broadcast' or 'send to children' mode?
Have you verified if only the touched planes are counted as "hit"?
Have you grouped your planes (temporary test objects if I get it right) with tags, because if you deleted objects with as specific tag it might destroy them all?

Also, you should consider pooling your objects instead of destroying them if possible.