Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
(30,5),(35,5) and (41,5)
after void updating

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseLook : MonoBehaviour
{

    public float sensitivity = 1.5f;
    public float smoothing = 10f;

    private float xMousePos;
    private float smoothedMousePos;

    private float currentLookingPos;

    private void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    void Update()
    {
        GetInput();
        ModifyInput();
        MovePlayer();
    }
    
    GetInput()
    {
        xMousePos = Input.GetAxisRaw("Mouse X");
    }

    ModifyInput()
    {
        xMousePos *= sensitivity * smoothing;
        smoothedMousePos = Mathf.Lerp(smoothedMousePos, xMousePos, 1f / smoothing);
    }

    MovePlayer()
    {
        currentLookingPos += smoothedMousePos;
        transform.localRotation = Quaterion.AngleAxis(currentLookingPos, transform.up);
    }
    
}


What I have tried:

I really don't know how i fix this and I kinda suck... I just need some help
Posted
Updated 25-Nov-22 6:21am

1 solution

You have 3 methods, GetInput, ModifyInput, and MovePlayer, none of which you've told the compiler how to return from. That is the return type. You need to specify either void or another type that your code is going to return a value from. In your code, you'll probably want void on all three of those methods.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900