Exemple #1
0
 public TFCollision(TFCollider collider)
 {
     this.collider = collider;
     gameObject    = collider.gameObject;
     rigidbody     = collider.body;
     transform     = collider.tdTransform;
 }
        private void Start()
        {
            fpTransform = GetComponent <TFTransform>();
            coll        = GetComponent <TFCollider>();
            if (!Application.isPlaying)
            {
                //In edit mode, return out.
                return;
            }
            coll.body            = this;
            info.position        = (FixVec2)fpTransform.Position;
            info.velocity        = FixVec2.zero;
            info.angularVelocity = Fix.zero;
            info.torque          = Fix.zero;
            info.force           = FixVec2.zero;

            invMass    = mass != Fix.zero ? Fix.one / mass : Fix.zero;
            invInertia = inertia != Fix.zero ? Fix.one / inertia : Fix.zero;
            RecalcAABB();
            TFPhysics.AddBody(this);
        }
 private void Awake()
 {
     fpTransform = GetComponent <TFTransform>();
     coll        = GetComponent <TFCollider>();
 }