playMaker

Author Topic: Player NPC Sound Detection HELP  (Read 2373 times)

p4martin

  • Playmaker Newbie
  • *
  • Posts: 4
Player NPC Sound Detection HELP
« on: December 11, 2014, 10:22:55 PM »
In my project, I wish to have NPCS and other player characters hear one another. For example, NPC's can hear the player's footsteps.

From what I have read, there are a few ways to implement this and the simplest seems to be by putting a sphere collider on the player, where the radius of the sphere collider can be adjusted according to the player's "Stealth" rating as an attribute, or by setting raidius by sound type such as a gunshot which has a much larger sound radius than say a footstep.

Each object that I wish to be able to hear the player, would also have a fixed radius sphere collider.

Thus depending the the radius of the players collider any NPC colliders within the player radius would trigger a collision and then say a "move toward sound action".

I do not seem to be able to even get the player and a cube to register a collision in playMaker and not sure what else to do.

For testing I put a collider on the player, and colliders on the cubes with rigidbodies. I set two states NO HEAR and HEAR. Using the collision enter and collision exit event, and attempting to grab collision object info via the Collision Event and the Get Collision Info Actions... Image included.

The FSM flips immediately to the HEAR state and there are no collisions.

Any Suggestions or examples would be awesome.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Player NPC Sound Detection HELP
« Reply #1 on: December 12, 2014, 10:07:06 PM »
Sounds to me as if you want to use a Trigger event and not a collision event- make sure your objects have colliders set to "On Trigger" then use the "Trigger Event" action set to On trigger Enter to detect the collisions and the "Get Trigger Info" action to get the hit object-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

p4martin

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Player NPC Sound Detection HELP
« Reply #2 on: December 12, 2014, 10:59:46 PM »
Ok Ill give that a try... do I need rigidbody on the objects?

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Player NPC Sound Detection HELP
« Reply #3 on: December 12, 2014, 11:00:47 PM »
No rigid body needed if using Trigger event
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

p4martin

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Player NPC Sound Detection HELP
« Reply #4 on: December 12, 2014, 11:01:57 PM »
Ok cool thanx... Ill tinker with that for a bit.