When a FinalIK behaviour initialises in the Start call of the first frame, it expects the character to be in the default T-Pose so that it can collect joint information to prepare its IK Solvers. This works with animations because the Mecanim Animator usually initialises AFTER all scripts have had their Start functions called.
However, if the PlayCutsceneOnStart script is used to trigger a Slate cutscene with an Animator track, and that script is executed before the FinalIK SolverManager in the Script Execution Order (which usually seems to be the case), then the character will be in an animated pose on the first frame, and the FinalIK joint data will be wrong, causing incorrect IK results at runtime.
We’ve worked around this EITHER by changing the FinalIK SolverManager Start function to an Awake function, OR by manually placing the Slate Cutscene script last in the Script Execution Order settings.
Perhaps the Cutscene behaviour should be last in the Script Execution Order by default?
Hmm.. As far as I understand, the problem here is not in the order which they update, but rather the order in which FinalIK initializes and PlayCutsceneOnStart call Play() on the target assigned cutscene ( which both happen on Start() ).
I think that the problem can also be solved by yielding one frame in the Start() function of PlayCutsceneOnStart.cs like so:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
usingUnityEngine;
usingUnityEngine.Events;
usingSystem.Collections;
namespaceSlate{
[AddComponentMenu("SLATE/Play Cutscene On Start")]
publicclassPlayCutsceneOnStart:MonoBehaviour{
publicCutscene cutscene;
publicUnityEvent onFinish;
IEnumerator Start(){
yield returnnull;
if(cutscene==null){
Debug.LogError("Cutscene is not provided",gameObject);
Yes, that fixes it, although we’ve tried this approach in other projects and it does of course introduce one frame that’s not controlled by the cutscene.
Hey,
Yes this will of course introduce a one frame delay before the cutscene starts (so that other scripts get a chance to initialize first), but I think that this is what we were after fixing here anyway, No? 🙂
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Author
Posts
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.