Quantcast
Viewing latest article 2
Browse Latest Browse All 18

FixedUpdate after Animation - Physics Loop

It seems that the built in animations play after other scripted FixedUpdate loops when 'Animate Physics' is selected - resulting in funny looking behaviour when moving a character in relation to these objects.

Is there a way to enforce the order animations will play in relation to another FixedUpdate loop? And if not, does it always execute after other FixedUpdate loops?

Since there isn't a function being explicity called, I'm not sure if I can control the call order in the normal way (calling a custom update function via some manager script).

I suppose I could 'fake' it by having the animated graphics lag a frame, but that's a bit funky --- this would be the code for that:

public class AnimatedPhysicsThing : MonoBehaviour {

    public Transform physics;
    private Transform graphics;
    private Vector3 lastPosition;

    private void Awake(){
        graphics = transform;   
    }


    private void FixedUpdate(){
        graphics.position = lastPosition;
        lastPosition = theTransform.position;   
    }
}

Viewing latest article 2
Browse Latest Browse All 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>