-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crouch functionality added #2544
Conversation
Hooray Jenkins reported success with all tests good! |
I think Crouching is an important, expected functionality. I am very grateful that you are looking into it nihal. But I wouldn't want to miss the opportunity to do it right. Ending up inside the cube above is certainly something requiring fixing: it "breaks" the game. Sounds like the collision capsule around the character needs resizing while crouching. Also, preventing falls would be quite a bonus if you could manage. I think @coty91 was recently looking at ways of detecting the blocks near the player. It might be easy to check if the block in the direction of motion is below the player and prevent further movement in that direction when reaching the border of the current block. Finally, crouching should probably slow down the player: 1/2, 1/3 speed perhaps? |
Max speed can be adjusted very easily. And yes, I will look into checking blocks around to implement the mc functionality. |
Hooray Jenkins reported success with all tests good! |
@emanuele3d Rising is prevented while crouching now, if there is something above. 😄 |
Hooray Jenkins reported success with all tests good! |
Hooray Jenkins reported success with all tests good! |
Hooray Jenkins reported success with all tests good! |
Hooray Jenkins reported success with all tests good! |
Hooray Jenkins reported success with all tests good! |
One thought: 'keep pressed to crouch' is quite an antiquated way to do it. Most games do it nowadays as a toggle. Press Ctrl to enter crouch, press Ctrl to exit crouch. Same for run mode. |
Hooray Jenkins reported success with all tests good! |
Reviewed and tested some, with more thoughts at http://forum.terasology.org/threads/crouch-and-prone-controls.1622/#post-14015 :-) I think the keys will be the trickiest. Looking for more feedback from others, like @Zireael07 there (thanks!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright formal final review is in with just a few minor changes requested before we merge this and do round two in another PR to cover other issues :-)
I take it the quirky issue being unable to stand back up in some two block high openings was entirely resolved? I can't seem to reproduce it. Yay! Testing seems good.
Anybody able to merge this after the last few changes feel free! Ship it :-)
*/ | ||
@RegisterBindButton(id = "toggleStance", description = "${engine:menu#binding-toggle-stance}") | ||
@DefaultBinding(type = InputType.KEY, id = Keyboard.KeyId.C) | ||
public class ToggleStanceButton extends BindButtonEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Rename class to CrouchModeButton
- that seems more clear ("Stance" is more related to the hybrid concept of walk / crouch / prone together) and would work with either crouching as a toggle or the thing I described in the forum about possibly using a key to change how CTRL
(as the main crouch button) would work.
As for the key I suggest we temporarily move it to x
with no intent to leave it there - it just allows us to merge this and get Omega builds that work, without changing the Equipment module (since it would be silly if we end up just changing that back) until we're sure how to deal with the keys (forum thread) in a follow-up PR
Finally whenever you see that goofy /** */
snippet in any class please get rid of it :-) It was a side product from a long time ago when we programmatically removed @author
tags - which didn't work quite right everywhere, sometimes leaving a dud javadoc block like that still in place
@@ -160,6 +170,43 @@ private void processInput(EntityRef entity, CharacterMovementComponent character | |||
jump = false; | |||
} | |||
|
|||
// Reduces height and eyeHeight by crouch_fraction and changes MovementMode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Change this (and similar blocks) to full fledged javadoc, even though technically javadoc might not be mandatory for private methods. Just seems like it makes for nicer formatting and context sensitive doc :-)
Are all the TODOs still relevant and could they be moved into the methods to a specific relevant line? Or if they are for sure needs (like the animation hook) maybe we can use a full GitHub issue instead of the TODO?
Vector3f to = new Vector3f(pos.x, pos.y + height, pos.z); | ||
SweepCallback callback = collider.sweep(pos, to, VERTICAL_PENETRATION_LEEWAY, -1f); | ||
if (callback.hasHit()) { | ||
entity.send(new NotificationMessageEvent("Cannot stand here!", entity)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny clarification: "Cannot stand up here" ? Seems to me like it would slightly better Indicate an inability to take an action to stand up there.
Hooray Jenkins reported success with all tests good! |
Hooray Jenkins reported success with all tests good! |
Uh oh, something went wrong with the build. Need to check on that |
Hooray Jenkins reported success with all tests good! |
Contains
Potential fix for #1075
How to test
Just hit LCtrl when in game. Keep it pressed to crouch.
There is a "blink" during crouching due to detach and attach of camera with different gazeMountPoint. Possibly can be fixed when a crouching animation is added.
The crouching factor (by which height changes) is kept as 0.5 now.
While crouching I can go in doors of length of 1 block, but on leaving LCtrl, I rise, and while doing so go inside the block above me. (FIXED)
Outstanding before merging