Hello.
I'd like to move softbody object with script.
for example, attach above code to softbody object.
Is it able to do this?
or if not, how can i do like this.
I'd like to move softbody object with script.
for example, attach above code to softbody object.
Code:
using UnityEngine;
using System.Collections;
public class Gravity : MonoBehaviour {
public GameObject planet;
public float accelerationScale;
void FixedUpdate () {
var direction = planet.transform.position - transform.position;
direction.Normalize();
GetComponent<Rigidbody>().AddForce(accelerationScale * direction, ForceMode.Acceleration);
}
}
Is it able to do this?
or if not, how can i do like this.