// TODO: Add OnGround property // FIXME/TODO: As it stands, setting the gameObject transform before adding a rigid body, // or first adding the rigid body and then modifying the transform, is... totally different! // This is not intended and must be fixed! public override void Awake() { var scale = gameObject.transform.scale; rigidBody = new RigidBody(new BoxShape(2 * scale.X, 2 * scale.Y, 2 * scale.Z)); PhysicSystem system = Game.Instance.GetSystem <PhysicSystem>(); system.world.AddBody(rigidBody); rigidBody.AllowDeactivation = false; CopyState(); }
public override void OnDestroy() { PhysicSystem system = Game.Instance.GetSystem <PhysicSystem>(); system.world.RemoveBody(rigidBody); }