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

touching

touching() 函数用于检查当前是否有手指触碰到球形触发区域。

语法

SphericalTriggerRegion.touching()

返回值

如果有手指触碰到球形触发区域,则返回 true,否则返回 false

示例

以下示例检查是否有手指触碰到名为 mySphere 的球形触发区域:

var mySphere = new SphericalTriggerRegion({
  // 触发区域的参数
});

if (mySphere.touching()) {
  // 触碰到了球形触发区域,执行相应操作
} else {
  // 没有触碰到球形触发区域,执行相应操作
}

注意事项

  • 在使用 touching() 函数检查触碰时,需要确保球形触发区域已经被创建并添加到了场景中。
  • 在手指按下触摸屏幕时,球形触发区域可能会被触碰。如果需要在松开手指时才检查是否触碰到了球形触发区域,可以在应用程序的触摸事件处理程序中调用 touching() 函数。