Skip to content
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

Merged
merged 12 commits into from
Oct 21, 2016
Merged

Crouch functionality added #2544

merged 12 commits into from
Oct 21, 2016

Conversation

nihal111
Copy link
Member

@nihal111 nihal111 commented Oct 15, 2016

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

  • Prevent falling off ledges like mc.
  • Display message "Cannot stand here!" when crouched under something. (Happening in chat panel now)
  • Implement crouch toggles.

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@emanuele3d
Copy link
Contributor

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?

@nihal111
Copy link
Member Author

Max speed can be adjusted very easily. And yes, I will look into checking blocks around to implement the mc functionality.
As for the collision capsule resizing that's exactly what I am doing, but when I change my stance to walking, the resizing happens again and now I go inside the block above me.
Basically I need to display a "cannot stand here" when I release the LCtrl and there is a block above me. After that I'll have to check whenever the player comes out of the enclosure and then make him stand.

@rzats rzats added the Category: Gameplay Content Requests, Issues and Changes targeting gameplay mechanics and content label Oct 15, 2016
@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@nihal111
Copy link
Member Author

@emanuele3d Rising is prevented while crouching now, if there is something above. 😄
Need to know how I can display a "Cannot stand here" message a corner in the screen. Could you help me with that?

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@Zireael07
Copy link

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.

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@Cervator
Copy link
Member

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!)

Copy link
Member

@Cervator Cervator left a 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 {
Copy link
Member

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.
Copy link
Member

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));
Copy link
Member

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.

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

This was referenced Oct 20, 2016
@GooeyHub
Copy link
Member

Uh oh, something went wrong with the build. Need to check on that

@GooeyHub
Copy link
Member

Hooray Jenkins reported success with all tests good!

@Cervator Cervator added this to the Alpha 6 milestone Oct 21, 2016
@Cervator Cervator merged commit 9b7e5e0 into MovingBlocks:develop Oct 21, 2016
Cervator added a commit that referenced this pull request Oct 21, 2016
@Cervator
Copy link
Member

Finally merged! Thanks for keeping at it :-)

Also submitted #2557 and put a couple slight addition in #2555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Gameplay Content Requests, Issues and Changes targeting gameplay mechanics and content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants