Skip to content

Commit 5e04f1a

Browse files
committedMay 8, 2017
Custom step height: Fix implementation
Recent commit 45ab62d had a coding error that made climbing out of water difficult due to an incorrect value of the step height when not 'touching ground'. It also incorrectly multiplied the custom stepheight by BS, resulting in being able to step-up 2 nodes if set to the default of 0.6, or even 0.3. Also the implementation was wrong because it customised the step height when not 'touching ground', this step height is for a slight rise when catching the edge of a node during a jump, and should always remain at 0.2 * BS.
1 parent 3342dcc commit 5e04f1a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed
 

Diff for: ‎src/localplayer.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,11 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
344344
}
345345
}
346346

347-
float player_stepheight = (m_cao == 0) ? 0.0 :
348-
(touching_ground ?
349-
(m_cao->getStepheight() * BS) :
350-
(m_cao->getStepheight() -0.4 * BS));
347+
float player_stepheight = (m_cao == 0) ? 0.0f :
348+
((touching_ground) ? m_cao->getStepheight() : (0.2f * BS));
351349

352350
#ifdef __ANDROID__
353-
player_stepheight += (0.6 * BS);
351+
player_stepheight += (0.6f * BS);
354352
#endif
355353

356354
v3f accel_f = v3f(0,0,0);

0 commit comments

Comments
 (0)
Please sign in to comment.