Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

PhysicsRayQueryParameters3D

继承: RefCounted < Object

PhysicsDirectSpaceState3D.intersect_ray 提供参数。

描述

通过修改这个对象的射线位置等属性,你可以为 PhysicsDirectSpaceState3D.intersect_ray 配置参数。

属性

bool

collide_with_areas

false

bool

collide_with_bodies

true

int

collision_mask

4294967295

RID[]

exclude

[]

Vector3

from

Vector3(0, 0, 0)

bool

hit_back_faces

true

bool

hit_from_inside

false

Vector3

to

Vector3(0, 0, 0)

方法

PhysicsRayQueryParameters3D

create ( Vector3 from, Vector3 to, int collision_mask=4294967295, RID[] exclude=[] ) static


属性说明

bool collide_with_areas = false

  • void set_collide_with_areas ( bool value )

  • bool is_collide_with_areas_enabled ( )

如果为 true,则查询将考虑 Area3D


bool collide_with_bodies = true

  • void set_collide_with_bodies ( bool value )

  • bool is_collide_with_bodies_enabled ( )

如果为 true,则查询将考虑 PhysicsBody3D


int collision_mask = 4294967295

  • void set_collision_mask ( int value )

  • int get_collision_mask ( )

查询将检测的物理层(作为位掩码)。默认情况下,会检测所有碰撞层。有关详细信息,请参阅文档中的 《碰撞层和掩码》


RID[] exclude = []

  • void set_exclude ( RID[] value )

  • RID[] get_exclude ( )

将被排除在碰撞之外的对象的 RID 列表。请使用 CollisionObject3D.get_rid 来获取与派生自 CollisionObject3D 的节点关联的 RID


Vector3 from = Vector3(0, 0, 0)

要查询的射线起点,使用全局坐标。


bool hit_back_faces = true

  • void set_hit_back_faces ( bool value )

  • bool is_hit_back_faces_enabled ( )

如果为 true,查询将命中背部面,这些背部面是启用了背面的凹多边形形状,或高度图形状。


bool hit_from_inside = false

  • void set_hit_from_inside ( bool value )

  • bool is_hit_from_inside_enabled ( )

如果为 true,查询会在从形状内部开始时检测到命中。在此情况下,碰撞法线将为 Vector3(0, 0, 0)。不会影响凹多边形形状和高度图形状。


Vector3 to = Vector3(0, 0, 0)

要查询的射线终点,使用全局坐标。


方法说明

PhysicsRayQueryParameters3D create ( Vector3 from, Vector3 to, int collision_mask=4294967295, RID[] exclude=[] ) static

返回一个新的、预配置的 PhysicsRayQueryParameters3D 对象。使用它可以使用最常见的选项快速创建查询参数。

var query = PhysicsRayQueryParameters3D.create(position, position + Vector3(0, -10, 0))
var collision = get_world_3d().direct_space_state.intersect_ray(query)