Hi, I have this script
public class Gravity : MonoBehaviour
{
public Transform planet;
public float fallSpeed = 5;
// Update is called once per frame
void Update ()
{
Vector3 direction = ( transform.position - planet.transform.position);
direction.Normalize();
//Vector3 rotation = new Vector3(direction, 0, direction);
transform.rotation = Quaternion.FromToRotation(transform.position, direction);
Debug.DrawRay(transform.position, -direction * 6, Color.green);
Debug.DrawRay(transform.position, Vector3.up * 3, Color.blue);
transform.Translate(Vector3.down * fallSpeed * Time.deltaTime);
//Physics.gravity = -direction;
}
}
As it is now, the ojects fall down the planet but I can not rotate them. So how can I do that ?