Skip to content

Instantly share code, notes, and snippets.

@vallentiin
Created October 4, 2020 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vallentiin/730187c5801bf63c9a82a33bac078938 to your computer and use it in GitHub Desktop.
Save vallentiin/730187c5801bf63c9a82a33bac078938 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FauxGravityBodys : MonoBehaviour
{
public FauxGravityAttractor attractor;
private Transform myTransform;
Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
rb.constraints = RigidbodyConstraints.FreezeRotation;
rb.useGravity = false;
myTransform = transform;
}
void Update()
{
attractor.Attract(myTransform);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment