Forums

OverviewV-Play 1 SupportRotate enitity with box collider › Reply To: Rotate enitity with box collider

OverviewV-Play 1 SupportRotate enitity with box collider › Reply To: Rotate enitity with box collider
#6337

Alex
V-Play Team

Hi,

you can simply set the rotation property of the entity. If you want to rotate the object on it’s center, you will have to move the children of the EntityBase left and up by half their width/height, since Box2D does not support the transformOrigin property.

EntityBase {
    entityType: "satellite"
    entityId: satellite
    id:satellite
    rotation: 45

    Image {
        id:asteroidImage
        width: 300
        height: 80
        x: -width/2
        y: -height/2
        source: "images/test satellite.png"
    }

    BoxCollider {
        id:collider
        width: 300
        height: 80
        x: -width/2
        y: -height/2
        fixedRotation: false
    }

    MovementAnimation {
        target: parent
        property: "pos"

        velocity: Qt.point(-200, 0)

        // start running from the beginning
        running: true
    }
}

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