21.5 C
New York
Monday, April 28, 2025

UNIT – What’s unsuitable with this floor test on my HSM?


I am engaged on a third-person platform recreation. The participant driver makes use of a hierarchical state machine taken from this video: https://www.youtube.com/watch?v=otuksjpwzo8

Utilizing Unity 6.0.

Presently, it’s arrange so that there’s a core state (mBaseGamePlayState) which branches out into two broader basic states (MstateGenairborne, Mstategengened) which then breaks down into extra particular states (stroll, bounce, and so on.) I’ve positioned the Logic to calculate whether or not It’s based mostly on the core state so you do not have to rewrite it for every class. This state additionally handles motion, and every of the courses that use it to change motion values ​​to get the motion I am searching for (drag, pace, and so on.)

// MBaseGameplayState

public override void FixedUpdateState()
{
    base.FixedUpdateState();

    // grounded test
    if (Physics.Raycast(_mPlayerSM._rb.rework.place, Vector3.down, .6f, LayerMask.GetMask("Floor")) == true && _mPlayerSM._rb.linearVelocity.y 

The issue begins with the bounce state. Provides a vertical drive to the participant’s inflexible physique and adjustments to the falling state when the RB’s Yvel is

Even when he walks, the RB pace is learn as 0, regardless that he strikes by including drive. Curiously, when a line is added to the StateMachine replace perform simply to serialize the pace of the RB, it begins altering the values, however breaks the transfer.

I’ve tried including the empty FixedUpDateStatates override to every of the associated courses (perhaps they weren’t being up to date/referred to as?) however to no avail. I’ve additionally tried including stricter conditionals for the switching states, however that does not appear to be the issue.

Very confused as to what the issue might be…assistance is appreciated 🙂

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles