AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

fieldOfView

fieldOfView 是 Yuka js库中的一个属性,用于表示3D场景中的视野范围。它的单位是弧度,范围取值从0到π。

用法

可以通过以下方式来设置和获取 fieldOfView 的值:

// 设置fieldOfView的值
camera.fieldOfView = Math.PI/4;

// 获取fieldOfView的值
const currentFieldOfView = camera.fieldOfView;

注意事项

  • fieldOfView 值发生变化时,应该及时更新相机矩阵来保证正确的投影效果。
  • fieldOfView 角度较大时,视野会更广,但场景景深会相应缩小,需要注意调整相应的物体位置和大小以保持正确的比例关系。
  • fieldOfView 角度较小时,视野会变窄,场景景深相应变得更深,需要注意精细调整相应的物体位置和大小以保持正确的比例关系。

示例

import { PerspectiveCamera } from 'yuka';

const camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 0, 10);
camera.lookAt(0, 0, 0);

// 设置fieldOfView的值
camera.fieldOfView = Math.PI/4;