Back to the future hoverboard
Posted: Sat Feb 24, 2018 4:09 pm
Hello,
I am trying to implement hoverboard effect with the API, but my attempts failed so far:
https://youtu.be/88sTBjYXHxg
Hoverboard: Same as in the movie . Basically one rigidbody hover over various ground surface, about 50cm.
What i tried so far is to constantly apply force (or impulse) in pre-tick callback like this:
All I achieved is an oscillating body, constantly jump up and down:
https://youtu.be/88sTBjYXHxg
I tried to apply impulse, instead of force, but same effect.
Maybe a 6DOF spring would be able to solve this, but I have one body only.
I have run out of ideas so far, so any suggestion is welcome.
Thank you!
I am trying to implement hoverboard effect with the API, but my attempts failed so far:
https://youtu.be/88sTBjYXHxg
Hoverboard: Same as in the movie . Basically one rigidbody hover over various ground surface, about 50cm.
What i tried so far is to constantly apply force (or impulse) in pre-tick callback like this:
Code: Select all
//Pre-tick callback (note the true as last parameter)
mDynamicsWorld->setInternalTickCallback(this->onPrePhysicsTickCallback, static_cast<void*>(this), true);
//actual pre-tick callback function
void cPhysicsWorld::onPrePhysicsTickCallback(btDynamicsWorld *world, btScalar timeStep)
{
...
if(mHoverBoardRigidBody.isOnGround(0.5f)) //simple ray cast down, which return true if anything is hit below within 0.5f range
{
mHoverBoardRigidBody.clearForces(); //seems to be neccessary, otherwise the force below doesn't come over gravity?
mHoverBoardRigidBody.applyCentralForce(btVector(0,100000.0f * timeStep,0)); //apply force if we are on ground, it seems i have to apply extremly big Y+ force here
}
...
}
All I achieved is an oscillating body, constantly jump up and down:
https://youtu.be/88sTBjYXHxg
I tried to apply impulse, instead of force, but same effect.
Maybe a 6DOF spring would be able to solve this, but I have one body only.
I have run out of ideas so far, so any suggestion is welcome.
Thank you!