Forums

OverviewV-Play 2 Support (Qt 5) › contactNormal property

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #7547

    Vlad

    Hi

     

    just curious, what was happend with contactNormal property, which worked in V-Play 1.x, but now it give very weird data

     

    thanks

    #7549

    Alex
    V-Play Team

    Hi vladest,

    what data are you receiving? We just ran some tests and got the same results on VPlay 1.5 and 2.0.

    Cheers,
    Alex

    #7550

    Vlad

    the x value is always 0 and the y is very small, something like 2e-45

    #7552

    Alex
    V-Play Team

    Is it possible to create a small project that contains the error and send it to support@v-play.net¬†? We haven’t been able to reproduce that issue so far.

    Cheers,
    Alex

    #7554

    Vlad

    Hi Alex

     

    this happens only when collisionTestingOnlyMode: true

    br,

    Vlad

    #7555

    Alex
    V-Play Team

    Hi Vlad,

    the contactNormal is calculated to determine the reaction of a body after a collision. As colliders with collisionTestingOnlyMode true do NOT respond to the collision, it is not calculated by Box2D internally. So this is the expected Box2D behavior, and it applies to both VPlay 1.5 and VPlay 2.0 in our tests.

    Why do you need to know the contactNormal in this type of collision?

    Cheers,
    Alex

    #7561

    Vlad

    Hi Alex

     

    I’ve implementing pool-like playfield. I’ve took CarChallenge demo as example of pool-physics, however my items starting from the edges of the screen and at appear time it becomes collided with walls. So I’m trying to avoid this

    #7573

    Alex
    V-Play Team

    I see, that’s a little tricky.

    The first approach that came to my mind is the following:

    No use of collisionTestingOnlyMode at all. Instead you set the “categories” property of the Walls to e.g. Box.Category1 and the “collidesWith” property of your items to e.g. Box.Category2 (different from the walls) initially

    This way they won’t collide upon appearance¬†of the item. And once the item passed the wall after creation, you can change the “collidesWith” property of your item to the same as the walls have.

    You will just have to figure out how to find out that the item has passed the wall initially. You could e.g. use a Timer and change the Category after a time that you are completely sure that you passed the wall. Or you use onXChanged and onYChanged signals to determine if the item is inside the “game field”, which of course could affect performance as they are called continuous. I am pretty sure there are also other and better possibilities, depending on your implementation.

    Could this work for you?

    Cheers,
    Alex

    • This reply was modified 4 years, 2 months ago by  Alex.
    • This reply was modified 4 years, 2 months ago by  Alex.
    • This reply was modified 4 years, 2 months ago by  Alex.
    #7580

    Vlad

    Hi Alex

     

    yes, Timer trick works it seems

    Thanks

     

Viewing 9 posts - 1 through 9 (of 9 total)

RSS feed for this thread

You must be logged in to reply to this topic.

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