Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class RigidbodyExtrapolator : MonoBehaviour
  4. {
  5. public new Rigidbody rigidbody;
  6.  
  7. void FixedUpdate()
  8. {
  9. transform.Translate(-rigidbody.velocity * Time.fixedDeltaTime, Space.World); // Cancel out the force applied by the rigidbody
  10. }
  11.  
  12. void Update()
  13. {
  14. transform.Translate(rigidbody.velocity * Time.deltaTime, Space.World); // Apply the rigidbody force
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement