Aiming While Crouched

Navarro Family 4 months ago in Game Creator updated by Marti (Lead Developer) 3 months ago 12

I'm sure this is probably possible with an advanced state animator, but I can't seem to nail it.

While I'm crouching, the aim animation state isn't functioning properly, (Gun isn't Pitched correctly, projectile trajectory lowered below ground, and some other minor issues)

What I'm looking to do is add an "AimwhileCrouch" State for my weapons, could you point me in the right direction?

Just a foot note, the only way I could get the Shooter Module to Work with crouch (Or any other state) was to add an Animation Layer between Layer2 and Layer3 (Called LayerC)  I'm assuming between Shooter Idle, Aim, and Reload all 3 animation Layers are consumed.  Crouching seems like a standard, yet robust feature, that would probably run alot smoother if it was an actual integration to GC, (Like Running/Jumping/Aiming etc.)  instead of a Custom User State.

Just my 2 cents

Unity version:
Game Creator version:
Satisfaction mark by Navarro Family 4 months ago

I am also interested about this one as I'm trying the same thing:D 

I made a Fix for it.

It's a little complicated because I unfortunately had to edit some of the weapon and shooter code, but it works flawlessly.

It basically adds an AIMCROUCH state on the Weapon.Asset (So that every weapon can have a unique state)

and a new action called AdvancedCrouch, that calls the new state.

(There's also a protocol in there that changes the state if you Aim and then crouch, as opposed to crouch and them aim)

I'm going to make a tutorial and post the CS scripts tonight after my son goes to bed, so stay tuned.


Replace those CS files in your project

Create a new LocomotionState called RevolverAimCrouch (or whatever weapon you have)

Load that State up with your own Crouch/Aim animations (load it like you would the regular crouch)

Fill out the new State Aiming Crouch Sections on your weapons

Add  Crouch on and off triggers to your player with the RonsCrouch action.

That should be it, :)


I am a novice coder at best a hobbyist.  This might not be the cleanest way to do this, but I believe the foundation is solid.

If anyone wants to cleanup the code,  or build upon my CS scripts, please do so and post the link here.

I Labeled all my additions and changes Rons MOD in the code comments, to make it easy to see what I did

Happy Creating!


I actually had this dilema too, whether to make the crouch state as part of the default Animator or use as a separate Character State. I decided to go with the second option, although I'm not entirely happy with it. Both have their pros and cons.

Glad you found a way to solve this, despite using custom code. I don't usually like sharing entire Game Creator scripts, but since it's to help other users, I'll leave them in the topic. Cheers!


My apologies, I wasn't thinking like that when I posted those, just trying to spread the knowledge, next time I'll just post code snippets.

I'll cast my vote for the first option (built In) for GC2.  

Crouch seems more important than dash, and when the Shooter and Melee systems get involved, it starts to get messy fast, and eventually code has to be messed with.  

I see everyone is throwing out suggestions like Parkour, Advanced Crafting, Dual Wield, etc. But those seem like bells and whistles compared to a smooth built in crouch system.  Just one consumers opinion of coarse.

Anyways, I can't wait to see what's coming next, thanks again for a great Game Creation Platform, it's saved me countless hours and Excedrin migraine tablets.   

Hey @Marti,

Is it possible to have this as an official update, what do you think?

I guess modifying the source files with these ones will work until the next update when stuff is going to get replaced..and I also fear that those may brake something in my project. 

Since Crouch + Shooting is a usefully mechanic, what is your opinion on this, do you have the time to put this inside the shooter module on a future update?

Just want to point out I forgot to add the WeaponEditor Script (super important if you want to use the inspector to adjust the AIM crouch animations or pitch offset) I'll attach it as a reply on the original script post above.

I hope the Devs. don't mind me posting one more script, but all the changes are inaccessible without it.


We would rather prefer you don't post the entire WeaponEditor script, but the places where the changes are. That script is very large and core to the Melee system. Otherwise you'll end up copy & pasting the entire Melee module


My apologies, Below are the changes that should be added to the WeaponEditor.cs if you're using my changes.

I'm getting a Video capture software and Mic. this week, so I can post legitimate tutorials on youtube, and stay out of trouble :)

This was only for Shooter, I never touched any of the Melee scripts, just the shooter weapon scripts, 

I was under the impression that the Melee Weapons used the MeleeWeapon.cs and the MeleeWeaponEditor.cs 

I didn't think any of  the Shooter Module scripts were required for Melee Weapons, because they are sold separate?

Wasn't planning on adding AimCrouch to Melee, I figure if you're forced to stand while using your sword, that makes sense to me logically, so I'm living with it.

Open WeaponEditor.cs

Add the following to PROPERTIES

private Section sectionStateAimCrouch;  (I put it right under the original aimstate)

private SerializedProperty spPitchOffsetCrouch; (Right under the original Pitch offset)

private SerializedProperty spAimingCrouch;  (underneath spAiming)

Add to INITIALIZERS  (You get the pattern to add these underneath their original Aiming counterparts) 

this.sectionStateAimCrouch = new Section("State Aiming Crouch", this.LoadIcon("State-Aiming"), this.Repaint);

this.spAimingCrouch = this.serializedObject.FindProperty("aimingCrouch");

this.spPitchOffsetCrouch = this.serializedObject.FindProperty("pitchOffsetCrouch");

Add to  // PAINT METHODS: Put mine so It falls underneath the original in the inspector. 


ADD THIS METHOD TO THE SCRIPT (below the original) 

private void PaintSectionStateAimingCrouch()
using (var group = new EditorGUILayout.FadeGroupScope(this.sectionStateAimCrouch.state.faded))
if (group.visible)

EditorGUILayout.PropertyField(this.spAimingCrouch, true);




Thanks Navarro. I really appreciate it