Created
December 8, 2016 14:01
-
-
Save Wolfos/49b37eda3843a675b20031e20a6d8021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class RigidbodyExtrapolator : MonoBehaviour | |
{ | |
public new Rigidbody rigidbody; | |
void FixedUpdate() | |
{ | |
transform.Translate(-rigidbody.velocity * Time.fixedDeltaTime, Space.World); // Cancel out the force applied by the rigidbody | |
} | |
void Update() | |
{ | |
transform.Translate(rigidbody.velocity * Time.deltaTime, Space.World); // Apply the rigidbody force | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment