Flying Pickups

I’m trying to get the player to run when I HOLD DOWN the Shift Key, not when I pressed and let go

  1. I introduced the shift key for running in the Action Map
  2. I introduced this code for it in ‘InputReader.cs’:
public bool IsSpeeding {get; private set;}
public event Action SpeedEvent;

    public void OnSpeeding(InputAction.CallbackContext context) 
    {
        if (context.performed) 
        {
            SpeedEvent?.Invoke();
            IsSpeeding = true;
        }

        else if (context.canceled) {
            IsSpeeding = false; // boolean, indicating that this action is only done when the key mapped to this is held down
    }
    }
  1. I placed this in ‘PlayerFreeLookState.Tick()’:
 if (stateMachine.InputReader.IsSpeeding)
            {
                stateMachine.Animator.SetFloat(FreeLookSpeedHash, 2 * movement.magnitude, AnimatorDampTime, deltaTime);
                FaceMovementDirection(movement, deltaTime);
                Move(movement * stateMachine.FreeLookMovementSpeed, deltaTime);
                return;
            } 

When I click the shift, sometimes it actually returns with no issues, and sometimes it doesn’t, and it stays there, and if you click the shift key again anytime soon, there’s no guarantees we will return to the walking state

This was working perfectly last night, I have absolutely no clue why it stopped working this morning…

Try logging out your conditions in OnSpeeding… Make sure that you’re logging both the performed and canceled. Then check to make sure that they are firing correctly.

Then log your if(stateMachine.InputReader.IsSpeeding) as well.

Also remember, that in Windows, repeated presses of the Shift key can invoke “Sticky Keys”…

This one works fine

this one is not always called…

This one works fine as well

I couldn’t think of a better button to use that…

But it may be the cause of the issue.

Experiment with a different key, try “Z”, for example. Beyond that, I’m not sure why Cancel wouldn’t be firing… Unity may be better positioned to explain that problem.

that was indeed the problem, but the “Z” key is an incredibly hard key to keep your hands on for sprinting, and even the Control Key last night for diving became a sudden headache to deal with. None of that was a problem until earlier today, and I did absolutely no changes to my code for that…

I hate this engine sometimes…

This one’s not the engine’s fault. Blame Microsoft.
You can fix it (Google “Windows Sticky Keys”), but this will mask the problem. In other words, you’ll have it working fine on your computer but players playing your game will have mysterious issues that they don’t understand.

an extra mission in the tutorials that goes “Hit the shift key 5 times and deactivate sticky keys” will probably do the trick… :stuck_out_tongue: (I can’t think of a better way to convey a universal message to the players tbh)

and if you’re playing my game from Mac, you’re on your own

Anyway, time for me to go dive into Nilly Willy with Construction, because all of a sudden I have a major problem with destruction and editing not working

Enjoy those one star reviews from the people who don’t like anything that requires modifying their computer’s settings to work. :slight_smile:

oh my dear god… :confused: (I really have no idea how else to make it better. a “Z” key for sprinting will probably rake in 100x more 1-stars than this one). I think when they realize the “Bug” (not a bug, I left that out on purpose) that they can build homes on water, they’ll be having a lot of fun :stuck_out_tongue: (but then they’ll be angry that they can’t move it around or delete it, because, well… the developer is running into some wild issues)

Frankly speaking though, I don’t think players will be spamming the shift key fast enough to invoke the “Sticky Keys” message, at least not as much as I do when testing it

Anyway, I’ll leave you for now. Construction has some malfunctioning systems that need urgent addressing :slight_smile:

What a neat little trick!

1 Like

could be significantly better if when we snap it to the ground, it also rotates to match the terrain right beneath it. Brian, can we also please integrate that into the script? I literally just noticed the importance of this as I was designing a bit more of the environment (which I still didn’t start working on because… well… I still need a few things for that)

If it’s not difficult, that is (OK I’ll be quiet, I already have a few topics waiting to be addressed :slight_smile: )

hey Brian. Quick question, is it true that Explosive’s animations are 100% based on root motion and an integrated character controller, and the entire thing is unusable without them? I was taking a peek on the asset store, and… that’s what reviews are saying, so I had to ask :slight_smile:

It does come with an integrated controller and a metric ton of scripts… I generally uncheck those, so they don’t get added to my projects.

The animations do contain root motion, but you can use them “in place” as well, simply by not enabling root motion in the Animator. I use them all the time.

1 Like

So the reviews were noobies complains, got it

Anyway, please have a look at my other bugs. They’re currently what’s stopping me from moving forward with my project :grinning_face_with_smiling_eyes:

That’s a bit more complex… there are packages in the asset store that can do that.

Examples of good ones, please? After we’re done investigating my weird bugs, that is :grinning_face_with_smiling_eyes:

Perhaps this: https://assetstore.unity.com/packages/tools/animation/ground-fitter-121798

that’s one handy little tool. Thank you for directing me to it :slight_smile:

Privacy & Terms