Giter Club home page Giter Club logo

Comments (7)

stephengold avatar stephengold commented on May 17, 2024

Interesting that the issue doesn't appear in HelloCharacter.

from libbulletjme.

stephengold avatar stephengold commented on May 17, 2024

It appears in HelloGhost, but not if I configure the character's gravity to 59.9 psu/sec2 instead of 60.
And note that HelloCharacter uses the default gravity, which is 29.4 psu/sec2.

from libbulletjme.

stephengold avatar stephengold commented on May 17, 2024

Sure enough:

bool btKinematicCharacterController::onGround() const
{
	return (fabs(m_verticalVelocity) < SIMD_EPSILON) && (fabs(m_verticalOffset) < SIMD_EPSILON);
}

from libbulletjme.

stephengold avatar stephengold commented on May 17, 2024

btKinematicCharacterController is chock full of thoughtless hacks and copypasta. It could benefit greatly from a complete rewrite. But not today! The less I modify it, the happier I'll be. Ideally, I'd simply add an isOnGround() method to the jmeKcc subclass and invoke that in place of btKinematicCharacterController::onGround().

btKinematicCharacterController contains a few protected fields that seem relevant:

  • m_wasOnGround is unfortunately set using the existing onGround() method, so no help there.
  • full_drop has the opposite sense of onGround(). Unfortunately it is updated only if m_verticalVelocity <= 0.0, so it's not useful during the rising half of a jump.
  • m_wasJumping has the opposite sense of onGround().

Of those 3 fields, m_wasJumping seems closest to providing the desired functionality. I've run a few tests, and it looks good.

from libbulletjme.

stephengold avatar stephengold commented on May 17, 2024

Okay, the fix is in Libbulletjme v14.5.0. In hindsight, I wish I'd made it return onGround() && !m_wasJumping;---less risk of a false positive that way.

from libbulletjme.

stephengold avatar stephengold commented on May 17, 2024

As written, TestPhysicsCharacter, TestQ3, and TestWalkingChar do not invoke onGround()---they permit jumping even when the character is airborne. In order to test this fix, those apps need minor modifications

from libbulletjme.

stephengold avatar stephengold commented on May 17, 2024

There's an issue with the current solution because it returns true after the character steps off the supporting surface. See the Forum discussion: https://hub.jmonkeyengine.org/t/linear-velocity-inconsistency-on-collisionlistener/47446/4

from libbulletjme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.