Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 1 Support › How to get collision impulse

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5561

    Elisabeth

    Hi all,

     

    I want to decrease player’s health in case of a collision. In the docs (BoxCollider) it is suggested that one could use fixture.onBeginContact to start a timer which decreases health periodically as long as the collsion happens. This approach doesn’t seem to take the force of the collision into account. So I think, touching something softly but for a long period of time is more unhealthy than colliding with high speed and bumping off. Box2D offers the normal impulse (“The normal impulse is just the normal force multiplied by the time step.” [Box2D manual]). Is it possible to access this property in Felgo? Is there another solution?

     

    Thanks for any advice, cheers

    Thomas

    #5565

    David

    Hi Thomas,

    you can see Ball.qml of the VPong demo which uses circleCollider.body.linearVelocity to determine the velocity of the ball which is decreased when it hits another object. There is also a counter available which increases the final force of the ball when the limit is reached. A combination of those properties could also be a solution for your Problem. Furthermore, you can start the timer with fixture.onBeginContact and stop it in fixture.onEndContact so you can also use the information for the duration of the collision.

    Cheers,

    David

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

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded