I’d like to rotate a component with transformOrigin:Item.Center. Unfortunately, the collider does not rotate around the same origin. How can this be fixed?
Cheers, Martin
import QtQuick 1.1
import VPlay 1.0
import Box2D 1.0
EntityBaseDraggable {
id: obstacle
width: 100; height: 100
selectionMouseArea.anchors.fill: rectangle
dragOffset: Qt.point(0,0)
delayDragOffset: true
clickingAllowed: true
transformOrigin: Item.Center
// RECTANGLE
Rectangle {
id: rectangle
color: "green"
anchors.fill: parent
}
// COLLIDER
BoxCollider {
id: collider
bodyType: Body.Static
}
onEntityClicked: obstacle.rotation += 10
}
import VPlay 1.0
import QtQuick 1.1
GameWindow {
activeScene: scene
width: 960; height: 640
Scene {
id: scene
width: 480; height: 320
Rectangle {
anchors.fill: parent
color: "gray"
}
PhysicsWorld { id: world }
// press on rect to rotate!
EBD { x: 100; y: 100 }
}
}