1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
import QtQuick
import QtQuick3D
import QtQuick3D.Physics
// Two bodies where one is scaled 1.5x*2x and the other 3x
// and they should have the same size.
Rectangle {
width: 640
height: 480
visible: true
PhysicsWorld {
scene: viewport.scene
forceDebugDraw: true
}
View3D {
id: viewport
anchors.fill: parent
PerspectiveCamera {
position: Qt.vector3d(0, 0, 1200)
eulerRotation: Qt.vector3d(0, 0, 0)
clipFar: 5000
clipNear: 1
}
DirectionalLight {
eulerRotation.x: -45
eulerRotation.y: 45
castsShadow: true
brightness: 1
shadowFactor: 100
}
StaticRigidBody {
eulerRotation: Qt.vector3d(10, 20, 30)
scale: Qt.vector3d(1, 1, 1).times(3)
collisionShapes: BoxShape {
position: Qt.vector3d(0, -100, 0)
}
}
Node {
scale: Qt.vector3d(1, 1, 1).times(2)
StaticRigidBody {
eulerRotation: Qt.vector3d(10, 20, 30)
scale: Qt.vector3d(1, 1, 1).times(1.5)
collisionShapes: BoxShape {
position: Qt.vector3d(0, 100, 0)
}
}
}
}
}
|