Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

PhysicsDirectSpaceState3D

Успадковує: Object

Успадковано від: PhysicsDirectSpaceState3DExtension

Забезпечує прямий доступ до фізичного простору в PhysicsServer3D.

Опис

Надає прямий доступ до фізичного простору в PhysicsServer3D. Він використовується переважно для виконання запитів до об'єктів та областей, що знаходяться в заданому просторі.

Примітка: Цей клас не призначений для безпосереднього створення екземплярів. Використовуйте World3D.direct_space_state, щоб отримати стан тривимірного фізичного простору світу.

Посібники

Методи

PackedFloat32Array

cast_motion(parameters: PhysicsShapeQueryParameters3D)

bool

cast_motion_into(parameters: PhysicsShapeQueryParameters3D, result: PhysicsCastMotionResult3D)

Array[Vector3]

collide_shape(parameters: PhysicsShapeQueryParameters3D, max_results: int = 32)

bool

collide_shape_into(parameters: PhysicsShapeQueryParameters3D, result: PhysicsCollideShapeResult3D)

Dictionary

get_rest_info(parameters: PhysicsShapeQueryParameters3D)

bool

get_rest_info_into(parameters: PhysicsShapeQueryParameters3D, result: PhysicsGetRestInfoResult3D)

Array[Dictionary]

intersect_point(parameters: PhysicsPointQueryParameters3D, max_results: int = 32)

bool

intersect_point_into(parameters: PhysicsPointQueryParameters3D, result: PhysicsIntersectPointResult3D)

Dictionary

intersect_ray(parameters: PhysicsRayQueryParameters3D)

bool

intersect_ray_into(parameters: PhysicsRayQueryParameters3D, result: PhysicsIntersectRayResult3D)

Array[Dictionary]

intersect_shape(parameters: PhysicsShapeQueryParameters3D, max_results: int = 32)

bool

intersect_shape_into(parameters: PhysicsShapeQueryParameters3D, result: PhysicsIntersectShapeResult3D)


Описи методів

PackedFloat32Array cast_motion(parameters: PhysicsShapeQueryParameters3D) 🔗

Перевіряє, наскільки далеко може рухатися Shape3D без зіткнення. Усі параметри запиту, включаючи фігуру та рух, надаються через об'єкт PhysicsShapeQueryParameters3D.

Повертає масив із безпечними та небезпечними пропорціями (між 0 та 1) руху. Безпечна пропорція – це максимальна частка руху, яку можна здійснити без зіткнення. Небезпечна пропорція – це мінімальна частка відстані, на яку потрібно переміститися для зіткнення. Якщо зіткнення не виявлено, буде повернуто результат [1.0, 1.0].

Примітка: Будь-які Shape3D, з якими фігура вже зіткнеться, наприклад, всередині, будуть ігноруватися. Використовуйте метод collide_shape, щоб визначити Shape3D, з якими фігура вже зіткнеться.


bool cast_motion_into(parameters: PhysicsShapeQueryParameters3D, result: PhysicsCastMotionResult3D) 🔗

Checks how far a Shape3D can move without colliding. All the parameters for the query, including the shape and the motion, are supplied through a PhysicsShapeQueryParameters3D object.

If the query is successful, this method returns true and writes the motion results into the PhysicsCastMotionResult3D object passed in result. If no collision occurs, it returns false.

Note: Any Shape3Ds that the shape is already colliding with e.g. inside of, will be ignored. Use collide_shape_into() to determine the Shape3Ds that the shape is already colliding with.


Array[Vector3] collide_shape(parameters: PhysicsShapeQueryParameters3D, max_results: int = 32) 🔗

Перевіряє перехрестя форми, за допомогою PhysicsShapeQueryParameters3D об'єкта, проти простору. Отриманий масив містить список точок, де форма перетинає інший. Як і з intersect_shape(), кількість отриманих результатів можна обмежити час обробки.

Повернення очок - список пар контактних точок. Для кожної пари перша у формі, що пропущена в PhysicsShapeQueryParameters3D об'єкт, другий - у складеній формі з фізичного простору.

Примітка: Цей метод не враховує motion властивість об'єкту.


bool collide_shape_into(parameters: PhysicsShapeQueryParameters3D, result: PhysicsCollideShapeResult3D) 🔗

Checks the intersections of a shape, given through a PhysicsShapeQueryParameters3D object, against the space.

If intersections are found, this method returns true and writes the collision points into the PhysicsCollideShapeResult3D object passed in result. If no intersections are found, it returns false.

The number of returned results can be limited using PhysicsCollideShapeResult3D.max_collisions, to reduce the processing time.

Note: This method does not take into account the motion property of the object.


Dictionary get_rest_info(parameters: PhysicsShapeQueryParameters3D) 🔗

Перевіряє перетини фігури, заданої через об’єкт PhysicsShapeQueryParameters3D, з пробілом. Якщо вона стикається з кількома фігурами, вибирається найближча. Повернений об’єкт – це словник, що містить такі поля:

collider_id: ідентифікатор об’єкта зіткнення.

лінійна_швидкість: швидкість об’єкта, що зіткнувся Vector3. Якщо об’єкт є Area3D, результатом є (0, 0, 0).

нормаль: нормаль зіткнення фігури запиту в точці перетину, спрямована від об’єкта, що перетинається.

точка: точка перетину.

rid: RID об’єкта, що перетинається.

форма: індекс фігури, що зіштовхується.

Якщо фігура нічого не перетинає, замість неї повертається порожній словник.

Примітка. Цей метод не враховує властивість motion об’єкта.


bool get_rest_info_into(parameters: PhysicsShapeQueryParameters3D, result: PhysicsGetRestInfoResult3D) 🔗

Checks the intersections of a shape, given through a PhysicsShapeQueryParameters3D object, against the space.

If the shape collides with one or more shapes, this method returns true and writes the nearest collision information into the PhysicsGetRestInfoResult3D object passed in result. If no collisions occur, it returns false.

Note: This method does not take into account the motion property of the object.


Array[Dictionary] intersect_point(parameters: PhysicsPointQueryParameters3D, max_results: int = 32) 🔗

Перевірте, чи є точка всередині будь-якої твердої форми. Положення та інші параметри визначаються за допомогою PhysicsPointQueryParameters3D. Форми точки всередині подаються в масиві, що містить словники з наступними полями:

collider: Об'єкт зв'язку.

collider_id: Код об'єкта.

rid: Інтерсекційний об'єкт RID.

`` форма``: Індекс форми згортання форми.

Кількість перехрестя може бути обмежена параметром max_results, щоб скоротити час обробки.


bool intersect_point_into(parameters: PhysicsPointQueryParameters3D, result: PhysicsIntersectPointResult3D) 🔗

Checks whether a point is inside any solid shape. Position and other parameters are defined through PhysicsPointQueryParameters3D.

If one or more shapes overlap the point, this method returns true and writes the intersection data into the PhysicsIntersectPointResult3D object passed in result. If no intersections are found, it returns false.

The number of intersections can be limited using PhysicsIntersectPointResult3D.max_intersections, to reduce the processing time.


Dictionary intersect_ray(parameters: PhysicsRayQueryParameters3D) 🔗

Включає промінь в заданому просторі. Рентгенівська позиція та інші параметри визначаються за допомогою PhysicsRayQueryParameters3D. Повернутий об'єкт є словником з наступними полями:

collider: Об'єкт зв'язку.

collider_id: Код об'єкта.

нормальний: Нормальною поверхнею об'єкта на місці перетину, або Vector3(0, 0, 0), якщо промен починається всередині форми і PhysicsRayQueryParameters3D.hit_from_inside є true.

позиція: Точка перетину.

face_index: Індекс обличчя на перетині точки.

Примітка: Повертає дійсний номер тільки якщо міжсектифікована форма є ConcavePolygonShape3D. В іншому випадку -1 повертається.

`` рід``: Інтерсекційний об'єкт RID.

`` форма``: Індекс форми згортання форми.

Якщо промен не перев'язував нічого, то повернувся порожній словник.


bool intersect_ray_into(parameters: PhysicsRayQueryParameters3D, result: PhysicsIntersectRayResult3D) 🔗

Intersects a ray in a given space. Ray position and other parameters are defined through PhysicsRayQueryParameters3D.

If the ray hits a shape, this method returns true and writes the intersection information into the PhysicsIntersectRayResult3D object passed in result. If nothing is hit, it returns false.


Array[Dictionary] intersect_shape(parameters: PhysicsShapeQueryParameters3D, max_results: int = 32) 🔗

Перевіряє перехрестя форми, за допомогою PhysicsShapeQueryParameters3D об'єкта, проти простору. У масиві, що містить словники з наступними полями:

collider: Об'єкт зв'язку.

collider_id: Код об'єкта.

rid: Інтерсекційний об'єкт RID.

`` форма ``: Індекс форми згортання форми.

Кількість перехрестя може бути обмежена параметром max_results, щоб скоротити час обробки.

Примітка: Цей метод не враховує motion властивість об'єкту.


bool intersect_shape_into(parameters: PhysicsShapeQueryParameters3D, result: PhysicsIntersectShapeResult3D) 🔗

Checks the intersections of a shape, given through a PhysicsShapeQueryParameters3D object, against the space.

If one or more shapes are found to intersect, this method returns true and writes the intersection data into the PhysicsIntersectShapeResult3D object passed in result. If no shapes are found to intersect, it returns false.

The number of intersections can be limited using PhysicsIntersectShapeResult3D.max_intersections, to reduce the processing time.

Note: This method does not take into account the motion property of the object.