Forums

OverviewV-Play 1 SupportBugs after update to version 1.4 › Reply To: Bugs after update to version 1.4

OverviewV-Play 1 SupportBugs after update to version 1.4 › Reply To: Bugs after update to version 1.4
#5743

Alex
V-Play Team

Hi,

the problem is the following:

Our old EntitiyBaseDraggable used the collider of the entity to determine if building was allowed of not. Because of this you could use the “fixture.onBeginContact” and “fixture.onEndContact” signals of the collider. But we were overriding some possible property bindings of the original collider internally, so this was no sufficient solution in some cases.

The new EntityBaseDraggable copies the collider of the entity internally, modifies it without touching the property bindings of the original collider, and uses the copy for collision detection instead. That’s why you are not recieving the signals.

I have a different solution for you, let me know if this is sufficient for you:

import QtQuick 1.1
import VPlay 1.0
import Box2D 1.0

EntityBaseDraggable {
  id: box
  entityType: "box"

  colliderComponent: boxCollider
  selectionMouseArea.anchors.fill: rect
  gridSize: 1
  height: 20
  width: 20
  dragOffset: Qt.point(0,0)
  //allowedToBuild: true

  property alias sWidth: rect.width
  property alias sHeight: rect.height
  //property bool isPlaced: false

  //showRectangleWhenBuildingNotAllowed: false
  preventFromRemovalFromEntityManager: false

  // you can access the properties of the rectangle that is shown when building is not allowed
  notAllowedRectangle.x: 0
  notAllowedRectangle.y: 0
  notAllowedRectangle.opacity: 1

  Rectangle {
    id: rect
    width: 30
    height: 30
    color: "yellow"
  }

  BoxCollider {
    id: boxCollider
    anchors.fill:rect
    density:100

    friction: 1.6
    restitution: 0

//    fixture.onBeginContact: {
//      if(!isPlaced) {
//        rect.color = "red";
//        allowedToBuild = false;
//      }
//    }

//    fixture.onEndContact:  {
//      rect.color = "yellow"
//      allowedToBuild = 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