IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

HeightFieldShape QML Type

A collision shape where the elevation is defined by a height map.

This type was introduced in Qt 6.4.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

HeightFieldShape QML Type

  • Import Statement: import QtQuick3D.Physics

  • Since:: Qt 6.4

  • Inherits:: CollisionShape

I. Detailed Description

The HeightFieldShape type defines a physical surface where the height is determined by the value of the pixels of the source image. The x-axis of the image is mapped to the positive x-axis of the scene, and the y-axis of the image is mapped to the negative z-axis of the scene. A typical use case is to represent natural terrain.

Objects that are controlled by the physics simulation cannot use HeightFieldShape: It can only be used with StaticRigidBody and kinematic bodies.

QtQuick3D.Helpers.HeightFieldGeometry is API compatible with the HeightFieldShape type, and can be used to show the height field visually. To improve performance, use a lower resolution version of the height map for the HeightFieldShape: As long as the extents and the image aspect ratio are the same, the physics body and the visual item will overlap.

I-1. See Also

II. Property Documentation

 

II-1. extents : vector3d

This property defines the extents of the height field. The default value is (100, 100, 100) when the heightMap is square. If the heightMap is non-square, the default value is reduced along the x- or z-axis, so the height field will keep the aspect ratio of the image.

II-2. source : url

This property defines the location of the heightMap file.

Internally, HeightFieldShape converts the height map image to an optimized data structure. This conversion can be done in advance. See the cooking overview documentation for details.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+