Skip to content

Commit

Permalink
Fix spray paint raycasting
Browse files Browse the repository at this point in the history
  • Loading branch information
DaXcess committed Aug 11, 2024
1 parent cd30cad commit 03352fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Source/Patches/Items/SprayPaintItemPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ namespace LCVR.Patches.Items;
[HarmonyPatch]
internal static class SprayPaintItemPatches
{
/// <summary>
/// Offset to make the spray paint come out of the tip of the can instead of from the hand
/// </summary>
private static readonly Vector3 SprayOffset = new(-0.1025f, 0.225f, 0.16f);

/// <summary>
/// Makes the spray paint item spray from your hand instead of your head
/// </summary>
Expand All @@ -19,10 +24,11 @@ internal static class SprayPaintItemPatches
private static bool SprayPaintFromHand(SprayPaintItem __instance, ref bool __result)
{
var rayOrigin = VRSession.Instance.LocalPlayer.PrimaryController.InteractOrigin;
var position = rayOrigin.TransformPoint(SprayOffset);

if (__instance.AddSprayPaintLocal(rayOrigin.transform.position, rayOrigin.transform.forward))
if (__instance.AddSprayPaintLocal(position, rayOrigin.forward))
{
__instance.SprayPaintServerRpc(rayOrigin.transform.position, rayOrigin.transform.forward);
__instance.SprayPaintServerRpc(position, rayOrigin.forward);
__result = true;
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Plugin : BaseUnityPlugin
{
public const string PLUGIN_GUID = "io.daxcess.lcvr";
public const string PLUGIN_NAME = "LCVR";
public const string PLUGIN_VERSION = "1.3.0";
public const string PLUGIN_VERSION = "1.3.1";

private readonly string[] GAME_ASSEMBLY_HASHES =
[
Expand Down

0 comments on commit 03352fb

Please sign in to comment.