Dear Felgoteam,
I’ve got an entitiy (Dog.qml) , which is moved with the help on Path Movement:
import QtQuick 1.1
import VPlay 1.0
EntityBaseDraggable {
id: dog
// columnn & row may be set from outside, for easier positioning along the grid
property int column
property int row
property int randomNumber
property real gridSize: scene.gridSize
property bool upWay;
property bool rightWay;
property bool downWay;
property bool leftWay;
entityType: "dog"
// when e.g. column = 0 is specified, the block should be placed centered at column 0
x: column*gridSize
y: row*gridSize
// these properties must be set for EntityBaseDraggable
selectionMouseArea.anchors.fill: dogImg
selectionMouseArea.onPressAndHold: removeEntity()//onEntityPressAndHold: removeEntity()
// Rectangle {
// id: dogImg
// color: "blue"
// width: gridSize+1
// height: gridSize+1
// anchors.left: parent.left
// //transformOrigin: Item.Center
// }
Image {
id: dogImg
width: gridSize
height: gridSize
anchors.left: parent.left//anchors.fill: parent
rotation: 90
transformOrigin: Item.Center
source: "../img/dog.png"
}
property int xPoint: 1
property int yPoint: 0
property int actualPosX: column*gridSize;
property int actualPosY: row*gridSize;
PathMovement {
velocity: 100
rotationAnimationDuration: 200
waypoints: [
{ x: actualPosX, y: actualPosY},
{ x: xPoint*gridSize, y: yPoint*gridSize}
]
onWaypointReached: {
column = xPoint
row = yPoint
chooseDirection()
move()
onPathCompleted: {
start()
}
}
BoxCollider {
id: collider
width: gridSize
height: gridSize
anchors.left: parent.left
bodyType: Body.Static
}
...
}
but the problem is, that it’s turning (rotation) at one of it’s edges (I think it’s the left-down corner) and for the program to work properly it has to turn around its center…
I’ve already tried “transformOrigin: Item.Center
” but it’s not working.
I’m hoping for a quick response.
Best regards,
PanflamCutie