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?
#5610

Alex
V-Play Team

Hi Martin, looks like Box2D is not fully supporting the transformOrigin property. Untill we can find another solution, i would recommend you to change the code of EBD.qml like this:

import QtQuick 1.1
import VPlay 1.0
import Box2D 1.0

EntityBaseDraggable {
  id: obstacle
  entityType: "obstacle"
  width: 100; height: 100

  selectionMouseArea.anchors.fill: rectangle
  dragOffset: Qt.point(0,0)
  delayDragOffset: true
  clickingAllowed: true

  colliderComponent: collider

  // RECTANGLE
  Rectangle {
    id: rectangle
    color: "green"
    width: obstacle.width
    height: obstacle.height
    x: -width/2
    y: -height/2
  }

  // COLLIDER
  BoxCollider {
    id: collider
    bodyType: Body.Static
    width: obstacle.width
    height: obstacle.height
    x: -width/2
    y: -height/2
  }

  onEntityClicked: obstacle.rotation += 10
}

Is this sufficient for your use case?

Cheers,
Alex

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