playMaker

Author Topic: Triggers On Footsteps[SOLVED]  (Read 2462 times)

Fletch

  • Junior Playmaker
  • **
  • Posts: 66
    • SneakOnTheLot.com
Triggers On Footsteps[SOLVED]
« on: July 12, 2013, 01:42:18 PM »
Okay, why does everything have to be so hard?  I really thought this one would be simple... it was actually simple in code but for some reason not so here.

I'm just looking to add footstep sounds to a character... simple, right?  I've done this in code so I thought it would be pretty easy. 

First, I place a sphere at the heel of each of my character's feet.  Set them as triggers.

Now I place an FSM on each of those triggers.  Within those FSMs I have Trigger Event set to On Enter.  When triggered it moves to the second state that generates a random number for the pitch.  The third state sets that pitch and plays the sound.

Bingo!  It works, right?  Well, sort of.  For some unknown reason it's only triggering the sound as the foot comes away from the terrain.

So I set it to look at tags.  I change the terrain to Grass tag and make the FSM Trigger Event fire only when it collides with an object tagged, Grass.

That should do it, right?

Well, not exactly.  Still firing only when the foot comes off the terrain.

What's going on here?

I've learned that it is typically something very small that I've overlooked.
« Last Edit: July 15, 2013, 01:44:52 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Triggers On Footsteps
« Reply #1 on: July 12, 2013, 03:49:52 PM »
Hi,

 it's likely not even triggering what you think it is, your terrain is concave, and concave triggers do not work with concave colliders, that's one possible source of problem.

OR, you should attached a physics component to the foot trigger, have you tried that? set it to "is kinematic" and see if that solve the problem.

bye,

 Jean

Fletch

  • Junior Playmaker
  • **
  • Posts: 66
    • SneakOnTheLot.com
Re: Triggers On Footsteps
« Reply #2 on: July 12, 2013, 04:13:39 PM »
I already had a Rigidbody on the collider, so I made the change to Kinematic but it made no difference.

I placed a large, flat cube I could walk on out on the terrain so it would be flat, and it made no difference.  It reacts exactly the same way the terrain did.

Grrr.


Fletch

  • Junior Playmaker
  • **
  • Posts: 66
    • SneakOnTheLot.com
Re: Triggers On Footsteps
« Reply #3 on: July 12, 2013, 07:45:00 PM »
Okay, it's not the best solution but I think I've found a simple yet effective happy medium.

Here is a good thread to helped to guide me.

http://hutonggames.com/playmakerforum/index.php?topic=2606.msg11781#msg11781

I followed his exact setup but added a state to change the pitch randomly.

The triggers still aren't firing perfectly but when you walk or run it's hard to tell cause they're happening so fast.

Not ideal but pretty solid.