playMaker

Author Topic: Trying to trigger a C4D animation thru a click (SOLVED)  (Read 683 times)

BredDev

  • Playmaker Newbie
  • *
  • Posts: 27
Trying to trigger a C4D animation thru a click (SOLVED)
« on: September 05, 2020, 05:06:25 AM »
Hey everyone.

So I've created a simple keyframed animated object in C4D, the lever is meant to move down when the player clicks it.

I've setup a simple FSM where when the player clicks on the lever, it needs to animate this C4D object, but nothings coming right and I've tried everything. 

https://imgur.com/a/1ekDIdO

I made it to Legacy, created a controller for it etc...I've even used a "Play Animation" action but even then it just plays automatically and doesn't work even when clicking the lever.

Is there a trick to getting a C4D animation to play from a trigger? :-\

Thank you in advance.
« Last Edit: September 05, 2020, 11:38:25 AM by Fedles »

BredDev

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Trying to trigger a C4D animation thru a click, what am I doing wrong?
« Reply #1 on: September 05, 2020, 10:07:53 AM »
So I managed to find a partial solution thru the forum to make the animation play after the Lever was triggered;

- The asset needed to be Deleted and Re-imported (again) as a Legacy file which I initially did, somewhere between tweeking it became corrupted.

- The animation 'Clip' also needed adjustment, unticking Play-Automatically was also the problem.

- I also included a 'Wait' FSM in the middle to flow as a buffer, so the animation wouldn't play straight away. Apart from waiting for just the Click itself, it doesn't solve any problem in the animation itself, just assurance the animation won't spaz out after clicking the trigger.

Anyway.

https://imgur.com/a/DgBOlkj

Now a new problem occurs after the animation plays...the object rotates after the animation plays. If anyone has a solution to this that would be awesome, I'll continue to test and see if I can fix it.
« Last Edit: September 05, 2020, 10:15:12 AM by Fedles »

BredDev

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Trying to trigger a C4D animation thru a click (SOLVED)
« Reply #2 on: September 05, 2020, 10:52:47 AM »
Success!

I figured out that the objects animations' Axis was somehow baked into the animation in Cinema, the object was rotated at Y:-70.91, but when the animation played after being clicked...it leveled out to Y:0.

This was mildly frustrating.

I think the animated object's problem was somewhere in Cinema 4D's placement values but I wasn't going to back into C4D and re-import the animation until it came right in Unity.

Solution:

I grabbed the rotation value of the lever (Y:-70.91), added a Set Rotation action on the animation FSM, chucked that Y value into the Y-Angle, made it update to Every Frame and Late Update to over-ride any other rotations.

And the animation works perfect as it should now.

Why didn't I just create a simple keyframe rotation animation of the objecting moving down thru the Animator window?

I did, and I realized if I'm going to import animated objects from C4D in the future that weren't just based on Up and Down animations it wouldn't solve my problem for the next time.

Anyway, it's all working. 8)

https://imgur.com/a/nyp3iEF
« Last Edit: September 05, 2020, 11:00:15 AM by Fedles »