OverviewV-Play 1 SupportPhysics, Bodies, MoveToPointHelper › Reply To: Physics, Bodies, MoveToPointHelper

OverviewV-Play 1 SupportPhysics, Bodies, MoveToPointHelper › Reply To: Physics, Bodies, MoveToPointHelper

V-Play Team


I found your problems, see the comments in-line for an explanation and for a working solution.

import VPlay 1.0
import QtQuick 1.1

GameWindow {

  Scene {
    id: scene

    PhysicsWorld {

      gravity.y: -10

    MouseArea {
      anchors.fill: parent
      onClicked: {
        actor.moveTo(mouseX, mouseY)

    EntityBase {
        id: actor
        entityType: "actor"

        width: 50
        height: 80

        transformOrigin: Item.TopLeft

        MoveToPointHelper {
          id: moveToPointHelper

          onOutputXAxisChanged: console.debug("outputXAxis changed to:", outputXAxis)

        Rectangle {
            id: rectangle
            anchors.fill: parent

            color: "red"

        BoxCollider {
            id: boxCollider

            anchors.fill: parent

            // !!! this causes a binding loop! this is the error output:
            // QML BoxCollider: Binding loop detected for property "force"
            // the reason: you are referencing force.y in the property binding
            //force: Qt.point(moveToPointHelper.outputXAxis * 1, force.y)

            // with this it works:
            // outputYAxis is needed, because the XAsis of MoveToPointHelper is looking at 0° initally, which means to the right
            // so if the yAxis is 1 this means your entity (looking up) should move right
            force.x: moveToPointHelper.outputYAxis * 1

            fixture.onBeginContact: {

        function jump(){

        function moveTo(mouseX, mouseY){
            moveToPointHelper.targetPoint = Qt.point(mouseX, actor.y);

    EntityBase {
      id: floor

      width: scene.width
      height: 20
      anchors.bottom: parent.bottom

      BoxCollider {
        anchors.fill: parent
        bodyType: Body.Static
      Rectangle {
        anchors.fill: parent
        color: "green"



Looks funny already, I’m looking forward to your game! 😉

Cheers, Chris

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
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support