playMaker

Author Topic: Help destroying object from raycast bullet hit  (Read 2553 times)

jaydmax

  • Playmaker Newbie
  • *
  • Posts: 3
Help destroying object from raycast bullet hit
« on: March 05, 2014, 03:12:39 PM »
Hi PM forum,

Can someone please help me in making a simple cube object be destroyed from a raycast bullet hit. I am new to playmaker and not a programmer. I been fighting with getting this to work for several days. I've tried searching to forums before posting but have not found anything regarding this.

Thanks in advanced.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Help destroying object from raycast bullet hit
« Reply #1 on: March 05, 2014, 03:56:03 PM »
Using ray cast action you will be able to get the hited game object (store it on a game object variable)
Then use destroy game object action to destroy it.
Cheers
Seb

jaydmax

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Help destroying object from raycast bullet hit
« Reply #2 on: March 05, 2014, 04:57:09 PM »
Thanks for the reply Seb.

I am still not doing something right. I've attached a picture illustrating my current attempt. Can you please guild me in figuring out what i'm missing.

Thanks
« Last Edit: March 05, 2014, 05:01:55 PM by jaydmax »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Help destroying object from raycast bullet hit
« Reply #3 on: March 05, 2014, 05:04:11 PM »
You need to store the hit cube in a Game Object variable. The raycast will go out and 'hit' stuff, when it hits stuff it returns a bunch of information, like the object that it hit.

Make a Game Object variable to store that data. The Raycast action has all those options and Store Hit Object is where you tell it you want it to put the object that it hit.

Now that you stored it you can go to State 2 and use Destroy Object, then just put that variable in the slot... *poof*.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jaydmax

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Help destroying object from raycast bullet hit
« Reply #4 on: March 05, 2014, 06:16:19 PM »
Thanks for the input Lane.

I am still having problems getting it to work. I have tried to follow the instructions given but its just not working for me. I have attached an updated image.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Help destroying object from raycast bullet hit
« Reply #5 on: March 05, 2014, 08:08:01 PM »
What is it doing? It seems like all the variables are being filled. Maybe post the repro scene.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Help destroying object from raycast bullet hit
« Reply #6 on: March 06, 2014, 05:39:18 PM »
Try using a custom event instead of FINISHED event. That can be tricky.
Or maybe you didnĀ“t set up well the layer masks? You could debug a ray to be more accurate using Debug check box.
Cheers
Seb