playMaker

Author Topic: [SOLVED]Best way to give object health and have it destroyed?  (Read 2262 times)

wolfen231

  • Playmaker Newbie
  • *
  • Posts: 2
[SOLVED]Best way to give object health and have it destroyed?
« on: August 05, 2014, 06:52:08 AM »
So I am really new to all this but followed the tutorials. I am actually curious how I would get an object to have a health pool and then have that pool drained.

Does it need a isTrigger object? Or will the normal collision of the object suffice?

Basically I want to make a exploding barrel.

Just a point into the right direction is good. I gotta learn this stuff through experimentation.  :)
« Last Edit: August 05, 2014, 07:23:01 AM by wolfen231 »

600

  • Moderator
  • Hero Member
  • *****
  • Posts: 728
    • 600
Re: Best way to give object health and have it destroyed?
« Reply #1 on: August 05, 2014, 07:10:25 AM »
Hello,

isTrigger would be more for a zone Player enters and barrel explodes or starts a count down.

I would use On Collision Enter. This works if atleast one gameObject have a rigidbody component, the barrel or a baseball bat/a bullet could have a rigidbody.
Hitting the barrel, it would catch collision float for example and subtract from Health float in fsm. Compare Health float and if its 0 then explode :)

wolfen231

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Best way to give object health and have it destroyed?
« Reply #2 on: August 05, 2014, 07:22:41 AM »
Ahhh great see. This is what I was looking for. Here I was trying to solve the isTrigger situation when I could of just used a rigidbody. Derrrr.

Now to figure out the rest... like setting up the float for its  health and stuff. This gets me going in the right direction though.

Thanks!