C
C#14mo ago
Elmishh

✅ mouse input for a vr game plugin

https://discord.com/channels/143867839282020352/1112851954792665159/1112851954792665159 , don't tell me to go to unity server because it wasnt helpful at all
10 Replies
MODiX
MODiX14mo ago
Elmishh#6233
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
From Elmishh#6233
React with ❌ to remove this embed.
FusedQyou
FusedQyou14mo ago
Not helpful because nobody helped you? People help you when they are available, and it looks like PraetorBlue already gave you some tips. Why would you get any better help in here with something that is more suited for Unity? Just because it's C# doesn't mean people know more here 😄
ero
ero14mo ago
i imagine the unity server isn't that fond of modders
Elmishh
Elmishh14mo ago
Asked questions and just left Why? Pepple might People*
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Elmishh
Elmishh14mo ago
Im only starting new threads because threads kinda just die out and noone seems them
ero
ero14mo ago
just send a new message like "bump" in it and it'll get pushed to the top...
Elmishh
Elmishh14mo ago
Doesnt work Ive tried Posts just die like that
ero
ero14mo ago
incorrect
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View