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
qphysxtriggerbody.cpp
Go to the documentation of this file.
1
// Copyright (C) 2023 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
"qphysxtriggerbody_p.h"
6
7
#
include
"qphysicsutils_p.h"
8
#
include
"qtriggerbody_p.h"
9
10
#
include
"PxRigidActor.h"
11
12
QT_BEGIN_NAMESPACE
13
14
QPhysXTriggerBody
::
QPhysXTriggerBody
(QTriggerBody *frontEnd) :
QPhysXActorBody
(frontEnd) { }
15
16
DebugDrawBodyType
QPhysXTriggerBody
::
getDebugDrawBodyType
()
17
{
18
return
DebugDrawBodyType
::
Trigger
;
19
}
20
21
void
QPhysXTriggerBody
::
sync
(
float
/*deltaTime*/
,
22
QHash<QQuick3DNode *, QMatrix4x4> &
/*transformCache*/
)
23
{
24
auto
*triggerBody =
static_cast
<QTriggerBody *>(frontendNode);
25
const
physx
::
PxTransform
trf = QPhysicsUtils::toPhysXTransform(triggerBody->scenePosition(),
26
triggerBody->sceneRotation());
27
if
(!trf.isSane()) {
28
qWarning() <<
"TriggerBody: position/rotation is not finite, keeping previous pose."
;
29
return
;
30
}
31
32
// Only when it has moved: writing the pose wakes the actor, and a trigger
33
// that stands still should cost nothing. Writing it when it does move is
34
// what has PhysX test its pairs again.
35
if
(!QPhysicsUtils::fuzzyEquals(trf, actor->getGlobalPose()))
36
actor->setGlobalPose(trf);
37
}
38
39
QT_END_NAMESPACE
QPhysXActorBody
Definition
qphysxactorbody_p.h:29
QPhysXTriggerBody
Definition
qphysxtriggerbody_p.h:27
QPhysXTriggerBody::QPhysXTriggerBody
QPhysXTriggerBody(QTriggerBody *frontEnd)
Definition
qphysxtriggerbody.cpp:14
QPhysXTriggerBody::getDebugDrawBodyType
DebugDrawBodyType getDebugDrawBodyType() override
Definition
qphysxtriggerbody.cpp:16
QPhysXTriggerBody::sync
void sync(float deltaTime, QHash< QQuick3DNode *, QMatrix4x4 > &transformCache) override
Definition
qphysxtriggerbody.cpp:21
physx
Definition
qphysxactorbody_p.h:22
physx::PxTransform
PxTransformT< float > PxTransform
Definition
qabstractphysicsnode_p.h:28
DebugDrawBodyType
DebugDrawBodyType
Definition
qabstractphysxnode_p.h:42
DebugDrawBodyType::Trigger
@ Trigger
Definition
qabstractphysxnode_p.h:46
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
Definition
qtconfigmacros.h:161
QT_END_NAMESPACE
#define QT_END_NAMESPACE
Definition
qtconfigmacros.h:162
qtquick3dphysics
src
quick3dphysics
physxnode
qphysxtriggerbody.cpp
Generated on
for Qt by
1.18.0