コード例 #1
0
        private void UpdatePosition(Vertex3f targetPosition, float targetRotationY)
        {
            float theta   = targetRotationY + angleAroundPlayer;
            float offsetX = GetHorizontalDisatnace() * (float)Math.Sin(Maths.DegreeToRadian(theta));
            float offsetZ = GetHorizontalDisatnace() * (float)Math.Cos(Maths.DegreeToRadian(theta));

            position.x = targetPosition.x - offsetX;
            position.z = targetPosition.z - offsetZ;
            position.y = targetPosition.y + GetVerticalDisatnace();
            this.yaw   = 180 - (targetRotationY + angleAroundPlayer);
        }
コード例 #2
0
 private float GetVerticalDisatnace()
 {
     return(this.distanceFromPlayer * (float)Math.Sin(Maths.DegreeToRadian(pitch)));
 }
コード例 #3
0
 private float GetHorizontalDisatnace()
 {
     return(this.distanceFromPlayer * (float)Math.Cos(Maths.DegreeToRadian(pitch)));
 }