C
C#2y ago
Elmishh

✅ 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}");
}
}
}
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
13 Replies
Thinker
Thinker2y ago
This would be much better suited for #game-dev or $unity.
Elmishh
ElmishhOP2y ago
Not a game dev Making a BepInEx plugin
Thinker
Thinker2y ago
Well it's still game-programming related
Elmishh
ElmishhOP2y ago
I guess yeah
Thinker
Thinker2y ago
You're using Unity
Angius
Angius2y ago
Angius
Angius2y ago
Seems Unity to me
Thinker
Thinker2y ago
looks unity to me
Elmishh
ElmishhOP2y ago
It is unity i guess
Thinker
Thinker2y ago
it is Unity, even if you're making a mod
Elmishh
ElmishhOP2y ago
Ill ask there then Got asked like 5 questions and didnt get a single answer on how
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server