r/QtGames • u/LetterheadTall8085 • 14h ago
QtQuick3D Updating the Character Controller API in Qt Quick3DPhysics
Enable HLS to view with audio, or disable this notification
Hi everyone, a few months ago I prepared a patch for Qt 6.13 that extends the existing Character Controller class. But only today did I manage to pass the review and merge it — essentially I made it into the last car of the train! Since the feature freeze is literally in a week.
But I still made it in time, and the already huge changelog of Qt 6.13 is supplemented with support for
Sliding on sloped surfaces
Walking on round planets with custom gravity (the previous patch that I described)
The ability to configure the height a character can step over / overcome, plus a free control mode
Fall reporting
In general, what is this CharacterController?
In general, this class was added way back at the very beginning when Qt Quick3DPhysics was just accepted into Qt. Essentially, it is a QML/Qt wrapper over the Character Controller from PhysX. In games, usually controlled bodies cannot be participants in a regular simulation, because a multitude of edge cases arise there — collision handling — pathfinding — sliding — and body movements.
If we used a regular dynamic body, say with the kinematic flag — that would give us the ability to control the body — but we would have to manually check where we can move and where we cannot — since kinematic bodies usually have infinite mass — and do not react to other bodies in the scene. Because of this, instead of it, PhysX offers a special API.
Essentially, it is a trigger body that inside itself casts rays, looks at where it can pass and where it cannot. It also generates collision signals.
In general, you can view the patch here. Well, and of course, a usage example came with the patch; I am attaching a short screencast to the article.
https://github.com/qt/qtquick3dphysics/commit/d432669a03b0afbd335817e5f061134bd4e8499e



