Ejemplo n.º 1
0
 void Attach(RaycastHit surfaceHit)
 {
     rootParent                 = surfaceHit.collider.transform.root; //get highest level transform of the tile we hit
     attached                   = true;
     attaching                  = true;
     rigidbody.isKinematic      = true;
     rigidbody.detectCollisions = false;
     transform.parent           = rootParent; //Set parent to the rootParent, so the humanoid now moves with the ship.
     if (surfaceHit.collider.GetType() == typeof(BoxCollider))
     {
         normalOfSurfaceVector = PositionToTile.PositionToNormalVector(surfaceHit.point, surfaceHit.collider);
         hitCollider           = (BoxCollider)surfaceHit.collider;
         hitPosition           = surfaceHit.point;
     }
     if (surfaceHit.collider.GetType() == typeof(MeshCollider))
     {
         normalOfSurfaceVector = Normals.Normal(surfaceHit);
         hitCollider           = (MeshCollider)surfaceHit.collider;
         hitPosition           = surfaceHit.point;
     }
 }