playMaker

Author Topic: Start animation on random frame  (Read 6907 times)

Gav (HeyBud)

  • Full Member
  • ***
  • Posts: 126
    • Tumblr
Start animation on random frame
« on: August 04, 2014, 02:37:42 PM »
Hi,

I have a loop set up in the Animator window. I need the animation to start on a random frame each time it starts up.

Please help me figure this out with PM.

Thanks, anyone!
« Last Edit: August 04, 2014, 05:35:09 PM by Sarcophagav »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Start animation on random frame
« Reply #1 on: August 05, 2014, 07:22:21 AM »
Hi,

 Could you ask on the Unity Answers or on the Unity Forum, caus eI am not sure how to do it myself or if it's event possible, googl search did not return anything useful.

The only huge hack I found was to set a very high speed for a short amount of time to get to a random place in your anim and then play at normal speed...

http://answers.unity3d.com/questions/659002/make-animator-start-at-random-frame-43.html

Bye,

 Jean

Gav (HeyBud)

  • Full Member
  • ***
  • Posts: 126
    • Tumblr
Re: Start animation on random frame
« Reply #2 on: August 05, 2014, 11:18:49 AM »
Thanks, Jean.

I'll let you know if I figure something out.

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Start animation on random frame
« Reply #3 on: August 05, 2014, 12:59:59 PM »
If this is with Mecanim, I'm not 100% sure this would be the right action to use specifically (as I haven't a scene that I can test it with at the moment) but would the "Set Animator Playback Time" be the right action to use here?

It seems to be able to give you the ability to set what time the playback is supposed to go to so if you feed it a random float value that might be something worth trying... That said, I don't have a scene open that I can test this with so this is more of a shot in the dark kinda thing... But if it's with mecanim that might be worth checking out. (and it's also with the mecanim action set that you'd have to DL from the wiki.)

Gav (HeyBud)

  • Full Member
  • ***
  • Posts: 126
    • Tumblr
Re: Start animation on random frame
« Reply #4 on: August 05, 2014, 01:20:55 PM »
If this is with Mecanim, would the "Set Animator Playback Time" be the right action to use here?

Good idea I'll give it a shot and let you know.

Gav (HeyBud)

  • Full Member
  • ***
  • Posts: 126
    • Tumblr
Re: Start animation on random frame
« Reply #5 on: August 14, 2014, 01:53:50 AM »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Start animation on random frame
« Reply #6 on: August 14, 2014, 02:05:43 PM »
Hi,

 that's unrelated, it's a Sprite Manager 2 action. Can you explain why you mention it here? Maybe I am missing something.

 Bye,

 Jean

Gav (HeyBud)

  • Full Member
  • ***
  • Posts: 126
    • Tumblr
Re: Start animation on random frame
« Reply #7 on: August 15, 2014, 04:12:00 PM »
I'm using sprites in the animation controller. I was hoping this would allow me to get and control a sprite frame  in a sequence. It was my thought to get a random int and plug it into this. To be honest, I don't know what sprite manager is yet. I put it here so i could remember and try it later. But I guess it won't work then. Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Start animation on random frame
« Reply #8 on: September 18, 2014, 09:13:23 AM »
Hi,

 Sprite Manager is one of the first 2d sprite system build for Unity and came out on the asset store when it launched, and become the first success story on the asset store. I used it and I think it has some very interesting and powerful features, especially coupled with EzGui, it has still the edge on a number of newer solution!

 Bye,

 Jean