Skip to content

Instantly share code, notes, and snippets.

@Wolfos
Created December 8, 2016 14:01
Show Gist options
  • Save Wolfos/49b37eda3843a675b20031e20a6d8021 to your computer and use it in GitHub Desktop.
Save Wolfos/49b37eda3843a675b20031e20a6d8021 to your computer and use it in GitHub Desktop.
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