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