From 7fcca180b6751249ae61c13660659501af5317cd Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 20 Feb 2013 20:08:04 -0800 Subject: [PATCH] Implement rudimentary jumping --- apps/openmw/mwmechanics/character.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 713f1bb3b4..6c8d558a4d 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -181,10 +181,17 @@ Ogre::Vector3 CharacterController::update(float duration) const MWWorld::Class &cls = MWWorld::Class::get(mPtr); const Ogre::Vector3 &vec = cls.getMovementVector(mPtr); + bool onground = world->isOnGround(mPtr); bool inwater = world->isSwimming(mPtr); bool isrunning = cls.getStance(mPtr, MWWorld::Class::Run); speed = cls.getSpeed(mPtr); + // This jump is all kinds of wrong. The speed is incorrect, the state should be set to + // Jump, and X/Y movement should be disallowed except for the initial thrust (which would + // be carried by "physics" until landing). + if(onground) + movement.z += vec.z * (500.0f*duration); + if(std::abs(vec.x/2.0f) > std::abs(vec.y) && speed > 0.0f) { if(vec.x > 0.0f)