Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qquick3dphysicslocationhit.cpp
Go to the documentation of this file.
1
// Copyright (C) 2026 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qquick3dphysicslocationhit_p.h"
6
#
include
<
PxQueryReport
.
h
>
7
8
QT_BEGIN_NAMESPACE
9
10
/*!
11
\qmlvaluetype locationHit
12
\inqmlmodule QtQuick3D.Physics
13
\since 6.13
14
\inherits queryHit
15
\brief Holds positional and normal information for a physics query hit.
16
17
\c locationHit extends \l queryHit to provide detailed spatial
18
data about an intersection, such as the exact hit point, surface normal, and distance.
19
20
This object is usually returned as a result of raycast or sweep queries in the physics scene.
21
*/
22
23
/*!
24
\qmlproperty vector3d locationHit::position
25
\readonly
26
\since 6.13
27
28
This property holds the world position of the intersection point.
29
*/
30
31
/*!
32
\qmlproperty vector3d locationHit::normal
33
\readonly
34
\since 6.13
35
36
This property holds the surface normal vector at the point of impact in world coordinates.
37
*/
38
39
/*!
40
\qmlproperty real locationHit::distance
41
\readonly
42
\since 6.13
43
44
This property holds the distance from the query ray/sweep origin to the intersection point.
45
46
\note For sweep queries this is negative when the swept shape already overlapped the hit
47
body at its starting position, and its magnitude is the penetration depth.
48
*/
49
50
QQuick3DPhysicsLocationHit::QQuick3DPhysicsLocationHit() =
default
;
51
52
QQuick3DPhysicsLocationHit::QQuick3DPhysicsLocationHit(
const
physx::PxLocationHit &hit,
53
const
physx::PxActorShape &actorShape)
54
: QQuick3DPhysicsQueryHit(hit, actorShape), m_distance(hit.distance)
55
{
56
if
(hit.flags & physx::PxHitFlag::ePOSITION)
57
m_position = QVector3D(hit.position.x, hit.position.y, hit.position.z);
58
59
if
(hit.flags & physx::PxHitFlag::eNORMAL)
60
m_normal = QVector3D(hit.normal.x, hit.normal.y, hit.normal.z);
61
}
62
63
QVector3D QQuick3DPhysicsLocationHit::position()
const
64
{
65
return
m_position;
66
}
67
68
QVector3D QQuick3DPhysicsLocationHit::normal()
const
69
{
70
return
m_normal;
71
}
72
73
float
QQuick3DPhysicsLocationHit::distance()
const
74
{
75
return
m_distance;
76
}
77
78
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtquick3dphysics
src
quick3dphysics
queries
qquick3dphysicslocationhit.cpp
Generated on
for Qt by
1.18.0