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

Alex
V-Play Team

Hi Martin,

the problem you are facing is not the image, at least not directly. The width and height of the image is not known initially, it is set a little bit delayed, when the image is loaded. This means the x and y value of your PolygonCollider are 0 initially and then changed at runtime. And that’s where the real problem is, runtime changes of the collider geometry properties is currently only implemented for BoxColliders.

We will add support for Cirlce- and PolygonColliders to the next daily build, until then I recommend setting the width and height of the image you load yourself initially, then the rest of your code can remain unchanged:

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

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