BillboardTransformThe BillboardTransform item implements a transformation that causes objects to face the camera. More... Inherits QtObject BillboardTransform instantiates the C++ class QGraphicsBillboardTransform This type was introduced in Qt 4.8. Properties
Detailed DescriptionSometimes it can be useful to make an object face towards the camera no matter what orientation the scene is in. The common name for this technique is "billboarding". When applied as a transformation, this class will replace the top-left 3x3 part of the transformation matrix with the identity. This has the effect of removing the rotation and scale components from the current world co-ordinate orientation. In QML, this can be used as follows to orient a pane to point towards the viewer: Item3D { mesh: Mesh { source: "pane.obj" } position: Qt.vector3d(2, 0, -20) transform: BillboardTransform {} effect: Effect { texture: "picture.jpg" } } Because the billboard transformation will strip any further alterations to the matrix, it will usually be the last element in the transform list (transformations are applied to the matrix in reverse order of their appearance in transform): Item3D { mesh: Mesh { source: "pane.obj" } position: Qt.vector3d(2, 0, -20) transform: [ Scale3D { scale: 0.5 }, Rotation3D { angle: 30 }, BillboardTransform {} ] effect: Effect { texture: "picture.jpg" } } The scale property is applied to the matrix after transform has performed the billboard transformation, so the above can also be written as follows: Item3D { mesh: Mesh { source: "pane.obj" } position: Qt.vector3d(2, 0, -20) scale: 0.5 transform: [ Rotation3D { angle: 30 }, BillboardTransform {} ] effect: Effect { texture: "picture.jpg" } } By default the billboard transform will cause the object to face directly at the camera no matter how the world co-ordinate system is rotated. Sometimes the billboard needs to stay at right angles to the "ground plane" even if the user's viewpoint is elevated. This behavior can be enabled using the preserveUpVector property: Pane { position: Qt.vector3d(2, 0, -20) transform: BillboardTransform { preserveUpVector: true } effect: Effect { texture: "picture.jpg" } } Property DocumentationThis property specifies whether the billboard transform should preserve the "up vector" so that objects stay at right angles to the ground plane in the scene. The default value for this property is false, which indicates that the object being transformed should always face directly to the camera This is also known as a "spherical billboard". If the value for this property is true, then the object will have its up orientation preserved. This is also known as a "cylindrical billboard". |