Forums

OverviewV-Play 1 Supportrotation: how to get same transformOrigin for item and collider? › Reply To: rotation: how to get same transformOrigin for item and collider?

OverviewV-Play 1 Supportrotation: how to get same transformOrigin for item and collider? › Reply To: rotation: how to get same transformOrigin for item and collider?
#5636

Martin

Thanks, the example above works fine. However, if I try with an image, it does not! Could you have a look at this EBD.qml?

import QtQuick 1.1
import VPlay 1.0
import Box2D 1.0

EntityBaseDraggable {
  id: obstacle
  entityType: "obstacle"
  width: image.width;
  height: image.height

  selectionMouseArea.anchors.fill: image
  clickingAllowed: true

  Image {
      id: image
      x: -width/2
      y: -height/2
      source: "img/menuBar-sd.png"
  }

/*
  Rectangle {
      id: rectangle
      width: image.width;
      height: image.height
      x: -width/2
      y: -height/2
      color: "yellow"
  }
*/

  PolygonCollider{
      id:collider
      bodyType: Body.Static
      x: image.width/2
      y: image.height/2
      vertices: [
          Qt.point(0, 0),
          Qt.point(384, 0),
          Qt.point(384, 49),
          Qt.point(0, 49)
      ]
  }

  onEntityClicked: {
      obstacle.rotation += 10
  }
}

The image is from squaby.

Cheers, Martin

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