float GetTorque(Thruster t) { Vector2 r = t.tile.pos - rb2d.centerOfMass; Vector3 localForce = transform.InverseTransformDirection(t.transform.up) * t.force; float torque = Vector3.Cross(r, localForce).z; //Debug.Log(r + " " + localForce + " " + torque); return(torque); }
public void ApplyThrusterForce(Thruster t) { rb2d.AddForceAtPosition(t.transform.up * t.force * t.Activation * Time.fixedDeltaTime, t.transform.position, ForceMode2D.Impulse); }