Skip to content
This repository was archived by the owner on Mar 12, 2022. It is now read-only.

Commit 710565f

Browse files
committed
Initial commit
0 parents  commit 710565f

7 files changed

Lines changed: 251 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vs/
2+
bin/
3+
obj/
4+
*.user

FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patreon: nitrog0d

Properties/AssemblyInfo.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using MelonLoader;
2+
using System.Reflection;
3+
using System.Runtime.InteropServices;
4+
using TrackingRotator;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle(ModBuildInfo.Name)]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct(ModBuildInfo.Name)]
14+
[assembly: AssemblyCopyright("Created by " + ModBuildInfo.Author)]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
18+
// Setting ComVisible to false makes the types in this assembly not visible
19+
// to COM components. If you need to access a type in this assembly from
20+
// COM, set the ComVisible attribute to true on that type.
21+
[assembly: ComVisible(false)]
22+
23+
// The following GUID is for the ID of the typelib if this project is exposed to COM
24+
[assembly: Guid("652febb3-e7bd-4f5c-8ac4-51e36b19bc9d")]
25+
26+
// Version information for an assembly consists of the following four values:
27+
//
28+
// Major Version
29+
// Minor Version
30+
// Build Number
31+
// Revision
32+
//
33+
// You can specify all the values or you can default the Build and Revision Numbers
34+
// by using the '*' as shown below:
35+
// [assembly: AssemblyVersion("1.0.*")]
36+
[assembly: AssemblyVersion(ModBuildInfo.Version)]
37+
[assembly: AssemblyFileVersion(ModBuildInfo.Version)]
38+
[assembly: MelonInfo(typeof(TrackingRotatorMod), ModBuildInfo.Name, ModBuildInfo.Version, ModBuildInfo.Author, ModBuildInfo.DownloadLink)]
39+
[assembly: MelonGame(ModBuildInfo.GameDeveloper, ModBuildInfo.Game)]
40+
[assembly: MelonOptionalDependencies("UIExpansionKit")]

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# TrackingRotator
2+
[![GitHub All Releases](https://img.shields.io/github/downloads/nitrog0d/TrackingRotator/total?style=for-the-badge)](https://github.com/nitrog0d/TrackingRotator/releases)
3+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/nitrog0d/TrackingRotator?style=for-the-badge)](https://github.com/nitrog0d/TrackingRotator/releases/latest)
4+
[![Support me on Patreon](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F1177520&query=data.attributes.patron_count&suffix=%20Patrons&color=FF5441&label=Patreon&logo=Patreon&logoColor=FF5441&style=for-the-badge)](https://patreon.com/nitrog0d)
5+
6+
Video preview soon.
7+
8+
A mod that lets you rotate your tracking, it was made with "play while laying down" in mind.
9+
10+
* **Warning:** The VRChat team is not very keen on modding or reverse engineering the game, while the mod does not include anything that would ruin the fun for others, using it may still be a bannable offence.
11+
12+
* **USE IT AT YOUR OWN RISK**, I am not responsible for any bans or any punishments you may get by using this mod!
13+
14+
## Installation
15+
* **Make sure you have run the [MelonLoader Installer](https://github.com/LavaGang/MelonLoader.Installer/releases/latest/download/MelonLoader.Installer.exe) by [LavaGang](https://github.com/LavaGang) first (feel free to join the [VRChat Modding Group Discord](https://discord.gg/jgvc9Fd) for help!).**
16+
* Download the [latest version](https://github.com/nitrog0d/TrackingRotator/releases/latest/download/TrackingRotator.dll) of the mod.
17+
* **Install the mod [UIExpansionKit](https://github.com/knah/VRCMods) by [knah](https://github.com/knah), it is required.**
18+
* Drag/copy the DLL files that you have downloaded into the Mods folder.
19+
* That's it! Now just run the game and the mod should be installed!
20+
21+
## How to use
22+
* Open the Quick menu and click the "Tracking rotation" button.
23+
* You can change rotation value, high precision value and "Reset rotation when a new world loads" in Mod settings (Quick menu -> Settings -> Mod settings).

TrackingRotator.csproj

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{652FEBB3-E7BD-4F5C-8AC4-51E36B19BC9D}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>TrackingRotator</RootNamespace>
11+
<AssemblyName>TrackingRotator</AssemblyName>
12+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
<MelonLoaderPath>C:\Program Files (x86)\Steam\steamapps\common\VRChat\MelonLoader</MelonLoaderPath>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Compile Include="TrackingRotatorMod.cs" />
36+
<Compile Include="Properties\AssemblyInfo.cs" />
37+
</ItemGroup>
38+
<ItemGroup>
39+
<Reference Include="Assembly-CSharp">
40+
<HintPath>$(MelonLoaderPath)\Managed\Assembly-CSharp.dll</HintPath>
41+
</Reference>
42+
<Reference Include="Il2Cppmscorlib">
43+
<HintPath>$(MelonLoaderPath)\Managed\Il2Cppmscorlib.dll</HintPath>
44+
</Reference>
45+
<Reference Include="MelonLoader">
46+
<HintPath>$(MelonLoaderPath)\MelonLoader.dll</HintPath>
47+
</Reference>
48+
<Reference Include="UIExpansionKit">
49+
<HintPath>$(MelonLoaderPath)\..\Mods\UIExpansionKit.dll</HintPath>
50+
</Reference>
51+
<Reference Include="UnhollowerBaseLib">
52+
<HintPath>$(MelonLoaderPath)\Managed\UnhollowerBaseLib.dll</HintPath>
53+
</Reference>
54+
<Reference Include="UnityEngine.CoreModule">
55+
<HintPath>$(MelonLoaderPath)\Managed\UnityEngine.CoreModule.dll</HintPath>
56+
</Reference>
57+
</ItemGroup>
58+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
59+
<PropertyGroup>
60+
<PostBuildEvent>xcopy /f /y "$(TargetPath)" "$(MelonLoaderPath)\..\Mods\$(TargetFileName)*"</PostBuildEvent>
61+
</PropertyGroup>
62+
</Project>

TrackingRotator.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31005.135
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackingRotator", "TrackingRotator.csproj", "{652FEBB3-E7BD-4F5C-8AC4-51E36B19BC9D}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{652FEBB3-E7BD-4F5C-8AC4-51E36B19BC9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{652FEBB3-E7BD-4F5C-8AC4-51E36B19BC9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{652FEBB3-E7BD-4F5C-8AC4-51E36B19BC9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{652FEBB3-E7BD-4F5C-8AC4-51E36B19BC9D}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {184DD356-DD8B-4738-9E83-AE05BC75CF89}
24+
EndGlobalSection
25+
EndGlobal

TrackingRotatorMod.cs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
using MelonLoader;
2+
using UIExpansionKit.API;
3+
using UnityEngine;
4+
5+
namespace TrackingRotator {
6+
7+
public static class ModBuildInfo {
8+
public const string Name = "TrackingRotator";
9+
public const string Author = "nitro.";
10+
public const string Version = "1.0.0";
11+
public const string DownloadLink = "https://github.com/nitrog0d/TrackingRotator/releases/latest/download/TrackingRotator.dll";
12+
public const string GameDeveloper = "VRChat";
13+
public const string Game = "VRChat";
14+
}
15+
16+
public class TrackingRotatorMod : MelonMod {
17+
private const string ModCategory = "TrackingRotator";
18+
private const string RotationValuePref = "RotationValue";
19+
private const string HighPrecisionRotationValuePref = "HighPrecisionRotationValue";
20+
private const string ResetRotationOnSceneChangePref = "ResetRotationOnSceneChange";
21+
22+
private static float rotationValue = 0f;
23+
private static float highPrecisionRotationValue = 0f;
24+
private static bool highPrecision = false;
25+
private static bool resetRotationOnSceneChange = false;
26+
27+
private static Transform cameraTransform = null;
28+
private static Quaternion originalRotation;
29+
30+
public override void OnApplicationStart() {
31+
MelonLogger.Msg("Mod loaded.");
32+
MelonPreferences.CreateCategory(ModCategory, "Tracking Rotator");
33+
MelonPreferences.CreateEntry(ModCategory, RotationValuePref, 22.5f, "Rotation value");
34+
MelonPreferences.CreateEntry(ModCategory, HighPrecisionRotationValuePref, 1f, "High precision rotation value");
35+
MelonPreferences.CreateEntry(ModCategory, ResetRotationOnSceneChangePref, false, "Reset rotation when a new world loads");
36+
ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Tracking rotation", ShowRotationMenu);
37+
OnPreferencesSaved();
38+
}
39+
40+
public override void OnSceneWasLoaded(int buildIndex, string sceneName) {
41+
if (resetRotationOnSceneChange) {
42+
if (cameraTransform) {
43+
cameraTransform.localRotation = originalRotation;
44+
}
45+
}
46+
}
47+
48+
public override void OnPreferencesSaved() {
49+
rotationValue = MelonPreferences.GetEntryValue<float>(ModCategory, RotationValuePref);
50+
highPrecisionRotationValue = MelonPreferences.GetEntryValue<float>(ModCategory, HighPrecisionRotationValuePref);
51+
resetRotationOnSceneChange = MelonPreferences.GetEntryValue<bool>(ModCategory, ResetRotationOnSceneChangePref);
52+
}
53+
54+
public override void VRChat_OnUiManagerInit() {
55+
cameraTransform = Object.FindObjectOfType<VRCVrCameraSteam>().field_Public_Transform_0;
56+
originalRotation = cameraTransform.localRotation;
57+
}
58+
59+
private static ICustomShowableLayoutedMenu rotationMenu = null;
60+
61+
// Based on knah's ViewPointTweaker mod, https://github.com/knah/VRCMods/blob/master/ViewPointTweaker
62+
private void ShowRotationMenu() {
63+
if (rotationMenu == null) {
64+
rotationMenu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescription.QuickMenu4Columns);
65+
66+
void Move(Vector3 direction) {
67+
cameraTransform.Rotate(direction, highPrecision ? highPrecisionRotationValue : rotationValue, Space.World);
68+
}
69+
70+
var transform = Camera.main.transform;
71+
72+
rotationMenu.AddSpacer();
73+
rotationMenu.AddSimpleButton("Forward", () => Move(transform.right));
74+
rotationMenu.AddSpacer();
75+
rotationMenu.AddSpacer();
76+
77+
rotationMenu.AddSimpleButton("Tilt Left", () => Move(transform.forward));
78+
rotationMenu.AddSimpleButton("Reset", () => cameraTransform.localRotation = originalRotation);
79+
rotationMenu.AddSimpleButton("Tilt Right", () => Move(-transform.forward));
80+
rotationMenu.AddSpacer();
81+
82+
rotationMenu.AddSpacer();
83+
rotationMenu.AddSimpleButton("Backward", () => Move(-transform.right));
84+
rotationMenu.AddSimpleButton("Left", () => Move(-transform.up));
85+
rotationMenu.AddSimpleButton("Right", () => Move(transform.up));
86+
87+
rotationMenu.AddToggleButton("High precision", b => highPrecision = b, () => highPrecision);
88+
rotationMenu.AddSpacer();
89+
rotationMenu.AddSpacer();
90+
rotationMenu.AddSimpleButton("Back", rotationMenu.Hide);
91+
}
92+
93+
rotationMenu.Show();
94+
}
95+
}
96+
}

0 commit comments

Comments
 (0)