VisibilityEnabler¶
Inherits: VisibilityNotifier < CullInstance < Spatial < Node < Object
只在大约可见时启用某些节点。
描述¶
当 RigidBody 和 AnimationPlayer 节点不可见时,VisibilityEnabler 将禁用它们。它只会影响与 VisibilityEnabler 本身相同场景中的其他节点。
如果你只是想接收通知,请使用 VisibilityNotifier 代替。
注意:VisibilityEnabler 由于性能原因使用了一个近似的启发式方法。它不会考虑墙和其他遮挡物(除非你使用了 Portal)。启发式这一实现细节,在未来的版本中可能会改变。如果你需要精确的可见性检查,请使用另一种方法,例如添加一个 Area 节点作为 Camera 节点的子节点和/或 Vector3.dot。
注意:VisibilityEnabler 不会影响场景初始化后添加的节点。
属性¶
|
||
|
方法¶
is_enabler_enabled ( Enabler enabler ) const |
|
void |
set_enabler ( Enabler enabler, bool enabled ) |
枚举¶
enum Enabler:
ENABLER_PAUSE_ANIMATIONS = 0 --- 这个启用程序将暂停AnimationPlayer节点。
ENABLER_FREEZE_BODIES = 1 --- 这个启用程序将冻结RigidBody节点。
ENABLER_MAX = 2 --- 表示Enabler枚举的大小。
属性说明¶
bool freeze_bodies
Default |
|
Setter |
set_enabler(value) |
Getter |
is_enabler_enabled() |
如果true
,RigidBody节点将被暂停。
bool pause_animations
Default |
|
Setter |
set_enabler(value) |
Getter |
is_enabler_enabled() |
如果true
,AnimationPlayer节点将被暂停。
方法说明¶
返回由给定的 Enabler 常量标识的启用程序是否处于活动状态。
设置由给定的Enabler常量识别的启用程序的活动状态。