TargetCamTransformHelper

Provides the position when rotating towards a direction usable for follow or target cameras. More...

Import Statement: import VPlay 2.0
Since: V-Play 2.5.0
Inherits:

Item

Properties

Detailed Description

The TargetCamTransformHelper provides the position when rotating towards a direction usable for follow or target cameras.

It outputs the properties targetX, targetY, targetZ given on the player position and rotation and the cameraDistanceHorizontal and cameraDistanceVertical.

Note: Qt3D and also the V-Play 3D Components are in a Tech Preview state and may change its API in future versions.

Example Usage

You can connect this component with the Scene3DVPlay camera properties like in this example:

 import VPlay 2.0
 import QtQuick 2.0

 GameWindow {

   // is needed by the Render3D component - to this entity the Entity objects are added to
   property alias rootEntity: scene3D.rootEntity

   Scene {
     id: gameScene

     Level {

       EntityBase {
         id: mainPlayer
       }// EntityBase

     }// Level

   }// GameScene

   TargetCamTransformHelper {
     id: targetCamHelper

     player: mainPlayer
     // move the camera behind the current player rotation by this value
     cameraDistanceHorizontal: -130
     // move the camera up the current player position by this value
     cameraDistanceHorizontal: -40
   }

   Scene3DVPlay {
     id: scene3D

     cameraPosition: targetCamHelper.targetPosition
   }

 }

For a complete game how to use Scene3DVPlay together with the Render3D component, see the CarChallenge 3D Demo.

Property Documentation

cameraDistanceHorizontal : real

Moves the camera behind the current player rotation by this value.


cameraDistanceVertical : real

Moves the camera up the current player position by this value.


player : Item

The player Item containing the source of position and rotation calculations.


targetPosition : vector3d

Output vector3d value containing the target position concluding of targetX, targetY, targetZ.


targetX : alias

Output target x position.


targetY : alias

Output target y position.


targetZ : real

Output target z position.


Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support