playMaker

Author Topic: Making a Nerf Dart Stick to an Object  (Read 1139 times)

TRUEfoe

  • Playmaker Newbie
  • *
  • Posts: 2
Making a Nerf Dart Stick to an Object
« on: June 02, 2016, 05:59:27 PM »
Hi guys, TRUEfoe here, brand new to Playmaker.  Working on a game that uses darts that I'm trying to make stick to certain objects.  Here's a short video of what I have so far,


I'm trying to figure out a better way to make the object stick to other objects on a random chance using Playmaker.  Right now I'm using "Is Kinematic" but that doesn't work on objects that move after getting shot.  Any ideas on what to do?

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Making a Nerf Dart Stick to an Object
« Reply #1 on: June 02, 2016, 07:29:41 PM »
I had to do this for a weapon on a current project-

Add a raycast or spherecast on the dart thats firing in its forward direction- use the cast to get the hitObject, hitPoint and hitNormal-

Parent the dart to the hitObject and use the hitPoint and hitNormal to attach and align it to where it hit on the surface of the object-

Instead of parenting you could also despawn/destroy the dart on impact after getting the variables you need- then use the hitPoint etc to spawn a new dart parented to the object on its surface-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

TRUEfoe

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Making a Nerf Dart Stick to an Object
« Reply #2 on: June 02, 2016, 09:17:02 PM »
Hiya, Thanks for the help! 

I was able to get the RayCast event to pick up correctly but wasn't sure about what to do with the parenting information to make it stick.  Which "Playmaker action" would you be able to set parent and also set the HitPoint and HitNormal?

Thanks in advance.