Fork Lifter Spaghetti Code

This commit is contained in:
Starpelly
2021-12-18 23:10:43 -05:00
parent e20cf19e11
commit 33bd99bbc1
502 changed files with 66320 additions and 0 deletions

View File

@ -0,0 +1,23 @@
using UnityEngine;
public class LookAlongVelocity : MonoBehaviour
{
public float minVelocity = 0.01f;
public new Rigidbody2D rigidbody;
private void Update ()
{
if (rigidbody == null)
return;
if (rigidbody.velocity.magnitude < minVelocity)
return;
var rotation = transform.eulerAngles;
var angle = Vector2.SignedAngle (Vector2.up, rigidbody.velocity);
rotation.z = angle;
transform.eulerAngles = rotation;
}
}