Ejemplo n.º 1
0
 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();
     }
 }
Ejemplo n.º 2
0
        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.");
            }
        }
Ejemplo n.º 3
0
 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);
 }