C#C
C#3y ago
elmish

✅ mouse position not working on a vr game? (legacy input system)

code:
using BepInEx;
using System;
using Technie.PhysicsCreator;
using UnityEngine;
using UnityEngine.InputSystem;
using Utilla;

namespace GorillaFPV
{
    /// <summary>
    /// This is your mod's main class.
    /// </summary>

    /* This attribute tells Utilla to look for [ModdedGameJoin] and [ModdedGameLeave] */
    [ModdedGamemode]
    [BepInDependency("org.legoandmars.gorillatag.utilla", "1.5.0")]
    [BepInPlugin(PluginInfo.GUID, PluginInfo.Name, PluginInfo.Version)]
    public class Plugin : BaseUnityPlugin
    {
        Vector3 resetPosition;
        float mouseMovementY;

        GameObject cube;
        void Setup()
        {
            GameObject placeHolderCube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            placeHolderCube.transform.localScale = Vector3.one * 0.08f;

            cube = Instantiate(placeHolderCube);
            cube.GetComponent<Collider>().enabled = false;
        }
        void Start() { Utilla.Events.GameInitialized += OnGameInitialized; }

        void OnEnable()
        {
            HarmonyPatches.ApplyHarmonyPatches();
        }

        void OnDisable()
        {
            HarmonyPatches.RemoveHarmonyPatches();
        }

        void OnGameInitialized(object sender, EventArgs e)
        {
            Setup();
            cube.transform.position = GorillaLocomotion.Player.Instance.rightHandFollower.position;
        }

        void FixedUpdate()
        {
            mouseMovementY = Mouse.current.position.ReadValue().y;
            cube.transform.position = Vector3.up * mouseMovementY;
            Debug.Log($"[gorillaRPV] PositionDebug[cube]: {cube.transform.position}");
            Debug.Log($"[gorillaRPV] PositionDebug[mouse]: {mouseMovementY}");
        }
    }
}
i get 0 and 0, 0, 0 in BepInEx console even when i move my mouse
image-5.png
Was this page helpful?