Beispiel #1
0
 void FixedUpdate()
 {
     transform.position = Vector3.Slerp(transform.position, goalPos, moveSpeed * Time.deltaTime);
     if (Vector3.Distance(transform.position, goalPos) < 0.4f)
     {
         Vector3 intermediate = goalPos;
         goalPos = oldPos;
         oldPos  = intermediate;
     }
 }
    // Update is called once per frame
    void Update()
    {
        //sync rotation Camera + Player
        Quaternion updateRotation = Quaternion.LookRotation(playerTarget.transform.position - transform.position);

        transform.rotation = Quaternion.Slerp(transform.rotation, updateRotation, speed * Time.deltaTime * 20);

        //sync movement Camera + Player, raise Camera always above floor level
        if (transform.position.y < floor.position.y + 2.0f)
        {
            PlayerMovement.closeToLava = true;
        }
        Vector3 updatePosition = playerTarget.transform.position - playerTarget.transform.forward * zOffset - playerTarget.transform.up * yOffset;

        transform.position = Vector3.Slerp(transform.position, updatePosition, Time.deltaTime * speed);
    }
Beispiel #3
0
    private void LateUpdate()
    {
        Vector3 newPos = playerTransform.position + cameraOffset;

        transform.position = Vector3.Slerp(transform.position, newPos, SmoothFactor);
    }
Beispiel #4
0
        public static Vector3d Slerp(Vector3d from, Vector3d to, double t)
        {
            Vector3 v3 = Vector3.Slerp((Vector3)from, (Vector3)to, (float)t);

            return(new Vector3d(v3));
        }
Beispiel #5
0
        public static DVector3 Slerp(DVector3 from, DVector3 to, double t)
        {
            Vector3 v3 = Vector3.Slerp((Vector3)from, (Vector3)to, (float)t);

            return(new DVector3(v3));
        }