Qt3DRender::QRayCaster Class
class Qt3DRender::QRayCasterQt3DRender::QRayCaster viene utilizzato per eseguire test di ray casting nelle coordinate del mondo 3D. Per saperne di più...
| Intestazione: | #include <qraycaster.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| In QML: | RayCaster |
| Eredita da: | Qt3DRender::QAbstractRayCaster |
| Stato: | Obsoleto |
Questa classe è deprecata. Si sconsiglia vivamente di utilizzarla nel nuovo codice.
Proprietà
Funzioni pubbliche
Slot pubblici
| 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) |
Segnali
| void | directionChanged(const QVector3D &direction) |
| void | lengthChanged(float length) |
| void | originChanged(const QVector3D &origin) |
Descrizione dettagliata
Il raggio 3D è definito dall'origine, dalla direzione e dalla lunghezza. Sarà influenzato dalle trasformazioni applicate all'entità a cui appartiene.
I test di ray casting verranno eseguiti ad ogni fotogramma fintanto che il componente è abilitato. La proprietà "hits" verrà aggiornata con l'elenco delle intersezioni.
Vedi anche QAbstractRayCaster, QScreenRayCaster e QNoPicking.
Documentazione delle proprietà
direction : QVector3D
Contiene la direzione del raggio 3D. Deve essere un vettore unitario.
Funzioni di accesso:
| QVector3D | direction() const |
| void | setDirection(const QVector3D &direction) |
Segnale di notifica:
| void | directionChanged(const QVector3D &direction) |
length : float
Contiene la lunghezza del raggio 3D.
Funzioni di accesso:
| float | length() const |
| void | setLength(float length) |
Segnale di notifica:
| void | lengthChanged(float length) |
origin : QVector3D
Contiene l'origine del raggio 3D nelle coordinate locali.
Funzioni di accesso:
| QVector3D | origin() const |
| void | setOrigin(const QVector3D &origin) |
Segnale di notifica:
| void | originChanged(const QVector3D &origin) |
Documentazione delle funzioni membro
[slot] void QRayCaster::setLength(float length)
Imposta la lunghezza del raggio su length.
Se il valore è minore o uguale a zero, il raggio viene considerato infinito.
Nota: Funzionesetter per la proprietà length.
Vedi anche length().
[slot] void QRayCaster::trigger()
Metodo di comodità per abilitare il componente e avviare i test utilizzando il raggio corrente.
Nota: questo slot è sovraccaricato. Per collegarsi a questo slot:
// 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)
Metodo pratico per impostare i dettagli dei raggi origin, direction e length e consentire al componente di avviare i test.
Nota: questo slot è sovraccaricato. Per collegarsi a questo slot:
// 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.