public void OnEnable() { m_thisRigidBody = this.GetParent <Unit>().GetComponent <BRigidBody>(); if (m_thisRigidBody == null) { Log.Warning("Constraint must be added to a game object with a BRigidBody."); } if (m_startWasCalled) { AddToBulletWorld(); } }
public override void Awake() { this._Unit = this.GetParent <Unit>(); BRigidBody rbs = this._Unit.GetComponent <BRigidBody>(); if (rbs == null) { Log.Warning("Can't nest rigid bodies. The transforms are updated by Bullet in undefined order which can cause spasing. Object {0}"); } m_collisionShape = this._Unit.GetComponent <BCollisionShape>(); if (m_collisionShape == null) { Log.Warning("BRigidBody component {0} does not have a BCollisionShape component."); } }
public bool AddRigidBody(BRigidBody rb) { if (!_isDisposed) { if (m_worldType < WorldType.RigidBodyDynamics) { Log.Warning("World type must not be collision only"); } if (rb._BuildCollisionObject()) { ((DiscreteDynamicsWorld)m_world).AddRigidBody((RigidBody)rb.GetCollisionObject(), rb.groupsIBelongTo, rb.collisionMask); rb.isInWorld = true; } return(true); } return(false); }