private RigidBody CreateBody() { Material material; if (JMaterial != null) { material = JMaterial.ToMaterial(); } else if (JPhysics.defaultPhysicsMaterial != null) { material = JPhysics.defaultPhysicsMaterial; } else { material = new Material(); } var result = new RigidBody(Shape, material); result.AffectedByGravity = AffectedByGravity; result.IsStatic = IsStatic; result.AllowDeactivation = AllowDeactivation; result.Damping = (LinearDamping ? RigidBody.DampingType.Linear : 0) | (AngularDamping ? RigidBody.DampingType.Angular : 0); result.EnableDebugDraw = EnableDebugDraw; if (isKinematic) { result.AffectedByGravity = false; result.Mass = 1e6f; } else if (Mass > 0) { result.Mass = Mass; } else { result.SetMassProperties(); } return(result); }
public static void CreateJMaterial() { var material = new JMaterial(); AssetDatabase.CreateAsset(material, AssetDatabase.GenerateUniqueAssetPath("Assets/JMaterial.asset")); }