playMaker

Author Topic: SET ANIMATION SPEED*SOLVED*  (Read 2608 times)

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
SET ANIMATION SPEED*SOLVED*
« on: December 12, 2013, 12:36:38 PM »
What is the best way to set the animation speed based on the speed the object is moving?
« Last Edit: December 12, 2013, 02:07:38 PM by wallaceb68 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: SET ANIMATION SPEED
« Reply #1 on: December 12, 2013, 12:57:52 PM »
Hi,

 Are you using legacy or Mecanim?

bye,

 Jean

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
Re: SET ANIMATION SPEED
« Reply #2 on: December 12, 2013, 01:03:07 PM »
legacy, thanks jean

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
Re: SET ANIMATION SPEED
« Reply #3 on: December 12, 2013, 01:08:12 PM »
jean, what i have is: an object that is moving on a itween path, and you know how when a path curves it slow's the speed down. well i would like to have the animation slow down also. what would be the easiest way?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: SET ANIMATION SPEED
« Reply #4 on: December 12, 2013, 01:18:37 PM »
Hi,

 You need to do some math and know your step stride and animation length, and then you use this stride and length as a base to compute the speed of your animation.

https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcROT0h5PhnGPILbGdN7u-HXbqYgQ6uRkirtqlW2fU4ek1rXCqbS

so, let's say your stride is 2 units per seconds ( In Unity units, be careful when importing fbx, it has  a scale factor).

if your object is moving at 10 units per seconds, then you need to set the animation speed to:

2 units/sec = 1
20 units/sec = ??

Your animation speed should be 20 *1 / 2 = 10. when the animation speed is set to 1, it plays at normal speed ( 2 units/sec), so we simply have to make a cross product.

Does that make sense?

bye,

 Jean

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
Re: SET ANIMATION SPEED
« Reply #5 on: December 12, 2013, 02:06:52 PM »
I figured it out with your post on "get game object speed" action, i us that to set my animation speed by( with alittle tweeking from " float operator") an it worked! thanks for your help.