コード例 #1
0
        private void SetCaseVelocity(GameObject cartridgeCase, CartridgeCaseEjectorComponent component, HullNode hullNode)
        {
            GameObject hullInstance = hullNode.hullInstance.HullInstance;
            Rigidbody  rigidbody    = hullNode.rigidbody.Rigidbody;
            Rigidbody  rigidbody2   = cartridgeCase.GetComponent <Rigidbody>();
            Vector3    rhs          = cartridgeCase.transform.position - hullInstance.transform.position;

            rigidbody2.SetVelocitySafe((component.transform.TransformDirection((Vector3)(component.initialSpeed * Vector3.forward)) + rigidbody.velocity) + Vector3.Cross(rigidbody.angularVelocity, rhs));
            rigidbody2.SetAngularVelocitySafe(component.transform.TransformDirection((Vector3)(component.initialAngularSpeed * Vector3.up)) + rigidbody.angularVelocity);
        }
コード例 #2
0
 private void SetCaseTransform(GameObject cartridgeCase, CartridgeCaseEjectorComponent component)
 {
     cartridgeCase.transform.position = component.transform.TransformPoint(Vector3.zero);
     cartridgeCase.transform.Rotate(component.transform.eulerAngles);
 }