--Imagine this is inside Simulation...

function module.ActiveThink(simulation, cmd)
	
    --Did the player have a movement request?
    local wishDir = nil
    if cmd.x ~= 0 or cmd.y ~= 0 or cmd.z ~= 0 then
        wishDir = Vector3.new(cmd.x, cmd.y, cmd.z).Unit
        simulation.state.pushDir = Vector2.new(cmd.x, cmd.z)
    else
        simulation.state.pushDir = Vector2.new(0, 0)
    end
   
    --Does the player have an input?
    if wishDir ~= nil then

        simulation.state.vel = MathUtils:GroundAccelerate(
            wishDir,
            simulation.constants.maxSpeed,
            simulation.constants.accel,
            simulation.state.vel,
            cmd.deltaTime
        )

		simulation.characterData:PlayAnimation(Enums.Anims.Walk,Enums.AnimChannel.Channel0, false)
    else
		simulation.characterData:PlayAnimation(Enums.Anims.Idle,Enums.AnimChannel.Channel0, false)
    end

    simulation.state.vel = MathUtils:VelocityFriction(simulation.state.vel, simulation.constants.flyFriction, cmd.deltaTime)

    local walkNewPos, walkNewVel, hitSomething = simulation:ProjectVelocity(simulation.state.pos, simulation.state.vel, cmd.deltaTime)
    simulation.state.pos = walkNewPos
    simulation.state.vel = walkNewVel
    
    --Do angles
    if wishDir ~= nil then
        simulation.state.targetAngle = MathUtils:PlayerVecToAngle(wishDir)
        simulation.state.angle = MathUtils:LerpAngle(
            simulation.state.angle,
            simulation.state.targetAngle,
            simulation.constants.turnSpeedFrac * cmd.deltaTime
        )
    end
end

return module
