// Use this for initialization
	void Start () {
		rb = GetComponent<Rigidbody>();
		rb.SetDensity(1.0f);
		Debug.Log("mass: "+rb.mass);
		Debug.Log("Volume: "+rb.mass/1);
	
	}
 static public int SetDensity(IntPtr l)
 {
     try {
         UnityEngine.Rigidbody self = (UnityEngine.Rigidbody)checkSelf(l);
         System.Single         a1;
         checkType(l, 2, out a1);
         self.SetDensity(a1);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #3
0
 void Start()
 {
     rb = GetComponent<Rigidbody>();
     rb.SetDensity(1.1f);
     rb.mass = rb.mass;
     rb.AddForce(Random.Range(-30f, 30f),
                 Random.Range(-12f, 12f),
                 Random.Range(-30f, 30f),
                 ForceMode.Impulse);
        // sc = GetComponent<SphereCollider>();
     rotation = new Vector3(Random.Range(-MaxRotation.x, MaxRotation.x),
                            Random.Range(-MaxRotation.y, MaxRotation.y),
                            Random.Range(-MaxRotation.z, MaxRotation.z));
     transform.Rotate(rotation);
 }
Exemple #4
0
 static int SetDensity(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.Rigidbody obj = (UnityEngine.Rigidbody)ToLua.CheckObject(L, 1, typeof(UnityEngine.Rigidbody));
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.SetDensity(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }