easy-games / chickynoid

A server-authoritative networking character controller for Roblox.
https://easy-games.github.io/chickynoid/
MIT License
221 stars 31 forks source link

Player's Character Model doesn't face direction that Player is looking in. #32

Closed caoqt1 closed 1 year ago

caoqt1 commented 1 year ago

It's just a small issue I noticed; I genuinely don't know if this can only be fixed by forking the CameraModule.

When in first person, your character model will face the direction your facing, however, scrolling out of first person, and your character will default to the direction you were previously walking in. Furthermore, when in first person and your looking around, other players can't see you facing the direction your actually facing in.

TheGibusGuy commented 1 year ago

You can force the character model to look where the camera is, if that's what you're looking for, by setting aimLock to 1 in a characters' moduleScript.

local module = {}
local Chickynoid = game:GetService("ReplicatedFirst").Packages.Chickynoid
local Enums = require(Chickynoid.Enums)

function module:Setup(simulation)

    -- blah blah
    simulation.constants.aimlock = 1 -- the part you are looking for

end

function module:GetCharacterModel(userId)
    --return game.ReplicatedFirst.Packages.Chickynoid.Assets.BigHeadRig
    return nil
end 

return module

The moduleScript for a movement type, such as MoveTypeWalking, will have some code to set the direction the model will face if aimLock is on.

--Do angles
if (self.constants.aimlock == 1) then

        if (cmd.fa) then
            -- face the firing angle
        end
    else    
        -- just face movement the direction as usual
end