hedge-dev / HMMCodes

Hedge Mod Manager community codes repository
14 stars 16 forks source link

[Feature Request][Sonic Frontiers] Allow redirection for "Disable Spin Charge Air Deceleration" #21

Open mikeploythai opened 11 months ago

mikeploythai commented 11 months ago

For the current "Disable Spin Charge Air Deceleration" code, Sonic is fixed to whatever direction he was in prior to spin charging in the air. I think a good quality of life improvement to this code is to allow the player to redirect where to land based on where they tilt the left stick.

I made an implementation of this in a physics mod I created, which uses Player.Kinematics to update the velocity vector using the GetForward() method. Just wanted to share this snippet and video demonstrations so someone can consider implementing this behavior in a much neater fashion lol. I hope what I provided can be helpful and insightful!

var kinematics = Player.Kinematics.Get();
if (kinematics == null) return;

// check if the player in the air
// check if LT is being held to prevent weird behaviors when spin charging a drop dash
// check if current state is the spin charge
if (
  !Player.Status.IsGrounded() &&
  Player.Input.IsDown(Player.InputActionType.PlayerSonicboom) &&
  Player.State.GetCurrentStateID<Sonic.StateID>() == Sonic.StateID.StateSpinBoostCharge
) {
  kinematics->Velocity += Player.Kinematics.GetForward();
}

Current implementation - https://youtu.be/fBZ_YGKGn78 My implementation - https://youtu.be/0ki7K9hYQkM

hyperbx commented 11 months ago

This is an interesting concept. It might be worth scaling the velocity to have a maximum magnitude though, as the player tends to rocket off if you keep holding in a direction. lol

I've implemented this locally and added a check for if the analog stick is neutral and it feels a bit less slippery, so I may experiment with this.

Thanks for your feedback!

mikeploythai commented 11 months ago

Tiny bit off topic, but could you provide an example for the IsAnalogNeutral method, which is what I assume you're using to check for neutrality? Can't find much documentation for an example integer to pass.