Forums

OverviewV-Play 2 Support (Qt 5)Troubleshooting BoxCollider collisions › Reply To: Troubleshooting BoxCollider collisions

OverviewV-Play 2 Support (Qt 5)Troubleshooting BoxCollider collisions › Reply To: Troubleshooting BoxCollider collisions
#12608

Kevin

Hello

Thanks for the quick response.

 

Questions:

  • I put in some code in the Pipe’s fixture.onBeginContact() to only run stopGame() if the item collided with was the player… Is below a good way selectively process collisions? Reason I’m doing this is that the code provided by the tutorial runs stopGame whenever there is any kind of collision, and the lowerpipe is constantly colliding with the ground.
if (collidedEntity.entityId == "player_0") {
                scene.stopGame()
            }

 

  • Doing a console.debug(collidedEntity.entityId) as per your provided code, outputs an id value of “player_0” Why is this the case? Based on my code below I was half expecting the output to be “instanceofplayer”

Player.qml:

EntityBase {
    id: player
    entityType: "player"

 

main.qml (inside the scene):

    Player {
        id: instanceofplayer
        x: 160
        y: 180
    }
    
  •  Last question: how do i output the entity id of the object experiencing the collision (not the other object)

 

Thanks so far! Quite helpful and happy with the quick response.

 

Kevin

 

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