ClippedCamera

Inherits: Camera < Spatial < Node < Object

包含碰撞的相机 Camera

描述

此节点扩展 Camera 以添加与 Area 和/或 PhysicsBody 节点的碰撞。摄像机无法穿过碰撞物体。

属性

bool

clip_to_areas

false

bool

clip_to_bodies

true

int

collision_mask

1

float

margin

0.0

ProcessMode

process_mode

0

方法

void

add_exception ( Object node )

void

add_exception_rid ( RID rid )

void

clear_exceptions ( )

float

get_clip_offset ( ) const

bool

get_collision_mask_bit ( int bit ) const

void

remove_exception ( Object node )

void

remove_exception_rid ( RID rid )

void

set_collision_mask_bit ( int bit, bool value )

枚举

enum ProcessMode:

  • CLIP_PROCESS_PHYSICS = 0 —- 相机通过 _physics_process 回调进行更新。

  • CLIP_PROCESS_IDLE = 1 —- 相机通过 _process 回调进行更新。

属性说明

Default

false

Setter

set_clip_to_areas(value)

Getter

is_clip_to_areas_enabled()

如果true,相机与Areas接触时停止。


  • bool clip_to_bodies

Default

true

Setter

set_clip_to_bodies(value)

Getter

is_clip_to_bodies_enabled()

如果true,相机在接触PhysicsBody时停止。


  • int collision_mask

Default

1

Setter

set_collision_mask(value)

Getter

get_collision_mask()

The camera’s collision mask. Only objects in at least one collision layer matching the mask will be detected. See Collision layers and masks in the documentation for more information.


Default

0.0

Setter

set_margin(value)

Getter

get_margin()

相机的碰撞距离。相机与碰撞物体的距离不能超过这个距离。


Default

0

Setter

set_process_mode(value)

Getter

get_process_mode()

相机的过程回调。请参阅ProcessMode

方法说明

  • void add_exception ( Object node )

添加碰撞例外,使相机不会与指定的节点碰撞。


  • void add_exception_rid ( RID rid )

添加碰撞例外,以使相机不会与指定的RID碰撞。


  • void clear_exceptions ( )

删除所有碰撞例外。


  • float get_clip_offset ( ) const

返回相机由于碰撞而偏移的距离。


  • bool get_collision_mask_bit ( int bit ) const

如果指定的位索引打开,则返回true

注意:位索引的范围是0-19。


  • void remove_exception ( Object node )

删除与指定节点的碰撞例外。


  • void remove_exception_rid ( RID rid )

删除指定 RID 的碰撞例外。


  • void set_collision_mask_bit ( int bit, bool value )

将指定的位索引设置为value

注意:位索引的范围是0-19。