QRaycast objects send a ray into the world and return collision results with body objects. You can create a constant raycast object that you can add to the world and update collision results at every physics step, or you can make instantaneous raycast calls at runtime using the QRaycast::RaycastTo static method. QWorld also provides methods for managing QRaycast objects.
More...
#include <qraycast.h>
|
int | collidableLayersBit =1 |
|
QRaycast objects send a ray into the world and return collision results with body objects. You can create a constant raycast object that you can add to the world and update collision results at every physics step, or you can make instantaneous raycast calls at runtime using the QRaycast::RaycastTo static method. QWorld also provides methods for managing QRaycast objects.
◆ QRaycast()
QRaycast::QRaycast |
( |
QVector |
position, |
|
|
QVector |
rayVector, |
|
|
bool |
enableContainingBodies = false |
|
) |
| |
Creates a raycast.
- Parameters
-
position | The position of the raycast. |
rayVector | The ray vector. |
enableContainingBodies | Determines whether a body should be ignored in raycast collisions if the ray position is inside the shape representing the body in the world. If set to true, these objects will be ignored in raycast collisions. |
◆ GetCollidableLayersBit()
int QRaycast::GetCollidableLayersBit |
( |
| ) |
|
Returns the bitmask of layers the ray can collide with. The bit mask defines the collidable layers a body object is part of. A raycast object will only collide with body objects that are present in the layers specified by this mask.
◆ GetContacts()
Returns contact list of the raycast.
◆ GetEnabledContainingBodies()
bool QRaycast::GetEnabledContainingBodies |
( |
| ) |
|
Returns whether to consider the body containing the ray's position. If set to true and the ray is inside a body's collision shape, the collision point will be the ray's starting point, and the first body hit will be this containing body.
◆ GetPosition()
Returns the position of the raycast.
◆ GetRayVector()
Returns the ray vector of the raycast.
◆ GetRotation()
float QRaycast::GetRotation |
( |
| ) |
|
Returns the rotation of the raycast.
◆ RaycastTo()
Sends a ray into the world with the given position and direction vector. Returns a collection of QRaycast::Contact containing collision information with body objects hit by the ray.
- Parameters
-
world | The world. |
rayPosition | The position of the ray. |
rayVector | The vector of the ray. |
collidableLayers | The target layer bits.
|
enableContainingBodies | Determines whether a body should be ignored in raycast collisions if the ray position is inside the shape representing the body in the world. If set to true, these objects will be ignored in raycast collisions. |
- Returns
- A collection of contacts as a result of the raycast operation.
◆ SetCollidableLayersBit()
QRaycast * QRaycast::SetCollidableLayersBit |
( |
int |
value | ) |
|
Sets the bitmask of layers the ray can collide with. The bit mask defines the collidable layers a body object is part of. A raycast object will only collide with body objects that are present in the layers specified by this mask.
- Parameters
-
value | A bit mask value to set.
|
◆ SetEnabledContainingBodies()
QRaycast * QRaycast::SetEnabledContainingBodies |
( |
bool |
value | ) |
|
Sets whether to consider the body containing the ray's position. If set to true and the ray is inside a body's collision shape, the collision point will be the ray's starting point, and the first body hit will be this containing body.
- Parameters
-
◆ SetPosition()
Sets the position of the raycast
- Parameters
-
◆ SetRayVector()
Sets the ray vector of the raycast
- Parameters
-
value | A ray vector to set. |
◆ SetRotation()
QRaycast * QRaycast::SetRotation |
( |
float |
value | ) |
|
Sets the rotation of the raycast
- Parameters
-
◆ manualDeletion
bool QRaycast::manualDeletion =false |
By default, objects included in the physics engine are deleted by the destructors of the objects they belong to. When this flag is enabled, it indicates that this object should never be deleted by this engine. It is disabled by default, and it is recommended to keep it disabled. However, it can be used if needed for advanced purposes and integrations.
The documentation for this class was generated from the following files: