Qt3DRender::QRayCaster Class
class Qt3DRender::QRayCasterQt3DRender::QRayCaster Se utiliza para realizar pruebas de trazado de rayos en coordenadas del mundo 3D. Más...
| Encabezado: | #include <qraycaster.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| En QML: | RayCaster |
| Heredado de: | Qt3DRender::QAbstractRayCaster |
| Estado: | Obsoleto |
Esta clase está obsoleta. Se desaconseja encarecidamente su uso en código nuevo.
Propiedades
Funciones públicas
Ranuras públicas
| void | setDirection(const QVector3D &direction) |
| void | setLength(float length) |
| void | setOrigin(const QVector3D &origin) |
| void | trigger() |
| void | trigger(const QVector3D &origin, const QVector3D &direction, float length) |
Señales
| void | directionChanged(const QVector3D &direction) |
| void | lengthChanged(float length) |
| void | originChanged(const QVector3D &origin) |
Descripción detallada
El rayo 3D viene definido por su origen, dirección y longitud. Se verá afectado por las transformaciones aplicadas a la entidad a la que pertenece.
Las pruebas de proyección de rayos se realizarán en cada fotograma siempre que el componente esté habilitado. La propiedad «hits» se actualizará con la lista de intersecciones.
Véase también QAbstractRayCaster, QScreenRayCaster y QNoPicking.
Documentación de la propiedad
direction : QVector3D
Almacena la dirección del rayo 3D. Debe ser un vector unitario.
Funciones de acceso:
| QVector3D | direction() const |
| void | setDirection(const QVector3D &direction) |
Señal de notificación:
| void | directionChanged(const QVector3D &direction) |
length : float
Almacena la longitud del rayo 3D.
Funciones de acceso:
| float | length() const |
| void | setLength(float length) |
Señal de notificación:
| void | lengthChanged(float length) |
origin : QVector3D
Almacena el origen del rayo 3D en coordenadas locales.
Funciones de acceso:
| QVector3D | origin() const |
| void | setOrigin(const QVector3D &origin) |
Señal de notificación:
| void | originChanged(const QVector3D &origin) |
Documentación de las funciones de miembro
[slot] void QRayCaster::setLength(float length)
Establece la longitud del rayo en length.
Si el valor es menor o igual que cero, se considera que el rayo es infinito.
Nota: Funciónde asignación para la propiedad length.
Véase también ` length()`.
[slot] void QRayCaster::trigger()
Método práctico para habilitar el componente y activar las pruebas utilizando el rayo actual.
Nota: Esta ranura está sobrecargada. Para conectarse a esta ranura:
// Connect using qOverload:
connect(sender, &SenderClass::signal,
rayCaster, qOverload<>(&QRayCaster::trigger));
// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
rayCaster, [receiver = rayCaster]() { receiver->trigger(); });[slot] void QRayCaster::trigger(const QVector3D &origin, const QVector3D &direction, float length)
Método práctico para configurar los detalles de los rayos origin, direction y length, y habilitar el componente para que active las pruebas.
Nota: Esta ranura está sobrecargada. Para conectarse a esta ranura:
// Connect using qOverload:
connect(sender, &SenderClass::signal,
rayCaster, qOverload(&QRayCaster::trigger));
// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
rayCaster, [receiver = rayCaster](const QVector3D &origin, const QVector3D &direction, float length) { receiver->trigger(origin, direction, length); }); © 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.