Exemplo n.º 1
0
    void LateUpdate()
    {
        Vector3 delta = transform.position - prevPosition;

        prevPosition = transform.position;

        foreach (Transform t in stuckObjects)
        {
            PawnAABB3D pawn = t.GetComponent <PawnAABB3D>();
            if (pawn)
            {
                PawnAABB3D.CollisionResults results = pawn.Move(delta);

                // TODO: move into PAWNAABB3D class?

                // convert local distance into world space
                Vector3 worldSpaceDistance = t.TransformVector(results.distanceLocal);
                // add to player position
                t.transform.position += worldSpaceDistance;
            }
            else
            {
                t.transform.Translate(delta);
            }
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// This initializes this component.
 /// </summary>
 void Start()
 {
     pawn     = GetComponent <PawnAABB3D>();
     velocity = new Vector3();
     DeriveJumpValues();
     rigidBody             = GetComponent <Rigidbody>();
     rigidBody.isKinematic = true;
     main = this;
 }
 /// <summary>
 /// This initializes this component.
 /// </summary>
 void Start()
 {
     pawn     = GetComponent <PawnAABB3D>();
     velocity = new Vector3();
     DeriveJumpValues();
     rigidBody             = GetComponent <Rigidbody>();
     rigidBody.isKinematic = true;
     main     = this;
     spawnRef = GameObject.Find("SpawnPoint");
 }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     pawn = GetComponent <PawnAABB3D>();
 }