- 0:00 - 09:00 no input provided
- 10:00 crouch key pressed (collision shape scales correctly, then is translated back to origin instead of staying on ground where it was set)
- 12:00 crouch key released
- 13:00 crouch key pressed
- 16:00 forward movement key pressed (applying a force to the body causes it to fall back to ground)
Code: Select all
if (this->input.keyLeftControl && !this->crouching)
{
this->crouching = true;
//Set scale
btVector3 scale = this->clientBody->getCollisionShape()->getLocalScaling();
scale.setY(crouchScale);
this->clientBody->getCollisionShape()->setLocalScaling(scale);
this->ghostObject->getCollisionShape()->setLocalScaling(scale);
this->collisionWorld->dynamicsWorld->updateSingleAabb(this->clientBody);
auto clientOrigin = this->clientBody->getWorldTransform().getOrigin();
btVector3 newOrigin = btVector3(clientOrigin.getX(), clientOrigin.getY() - 0.525, clientOrigin.getZ());
clientBody->getWorldTransform().setOrigin(newOrigin);
this->ghostObject->getWorldTransform().setOrigin(newOrigin);
}
Is there anything glaringlyobvious that stands out to anyone that I may be overlooking?