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

characterBias

characterBias 是 Yuka js 库中的 GoalEvaluator (目标评估器)接口,用于评估当前行为代理(Agent)的行为倾向。

描述

characterBias 可以被用来评估行为代理的行为倾向性,根据当前行为代理的内部驱动力度量其具有不同的特质。行为代理的决策取决于其内部驱动,使其对不同类型的行为有不同的偏好。因此,了解行为代理的行为偏向是设计和优化行为代理的关键部分。

API

let characterBias = new CharacterBias(traits);

参数

  • traits:代表行为代理独特特质的对象。必填项。

方法

calculateDesirability:用于计算行为代理的行为倾向。

calculateDesirability (characteristicValue) : Number
  • characteristicValue:一个自变量,代表行为倾向的特定特征。必填项。
  • 返回值:加权因子作为行为代理选择行动的参考标准。

例子

const traits = {
  aggressiveThreshold: 0.5,
  cautiousThreshold: 0.3,
  cautiousnessForce: 1.2,
  aggresivenessForce : -0.8
}

let characterBias = new CharacterBias(traits);

let aggressiveLevel = 0.8;

let desirability = characterBias.calculateDesirability(aggressiveLevel); 

console.log(`评估当前行为代理的行为倾向性得分为:${desirability}`);

异常

  • 如果 traits 不是一个对象,则会抛出一个 TypeError 异常。
  • 如果 characteristicValue 不是一个数字,则会抛出一个 TypeError 异常。