Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is it able to move softbody with script?
#1
Hello.

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.
Reply


Messages In This Thread
Is it able to move softbody with script? - by harapeco - 16-09-2019, 01:47 AM