Skip to content

Commit b45ea48

Browse files
committed
add warp predictions
1 parent e703ef0 commit b45ea48

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using UnityEngine;
88
using Harmony;
99

10-
[assembly: MelonInfo(typeof(SuperliminalPracticeMod.Main), "Superliminal Practice Mod", "0.3.3", "Micrologist#2351")]
10+
[assembly: MelonInfo(typeof(SuperliminalPracticeMod.Main), "Superliminal Practice Mod", "0.3.4", "Micrologist#2351")]
1111
[assembly: MelonGame("PillowCastle", "Superliminal")]
1212
[assembly: MelonGame("PillowCastle", "SuperliminalSteam")]
1313

PracticeModManager.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,31 @@ string GetGrabbedObjectTextString()
343343
if(resizeScript.isGrabbing && resizeScript.GetGrabbedObject() != null)
344344
{
345345
GameObject grabbedObject = resizeScript.GetGrabbedObject();
346-
return string.Concat(new object[]{
346+
string output = string.Concat(new object[]{
347347
grabbedObject.name+"\n",
348348
"Position: "+grabbedObject.transform.position.x.ToString("0.000")+", "+grabbedObject.transform.position.y.ToString("0.000")+", "+grabbedObject.transform.position.z.ToString("0.000")+"\n",
349-
"Scale: "+grabbedObject.transform.localScale.x.ToString("0.0000")+"x"
349+
"Scale: "+grabbedObject.transform.localScale.x.ToString("0.0000")+"x"
350350
});
351+
if(grabbedObject.GetComponent<Collider>() != null)
352+
{
353+
Collider playerCollider = player.GetComponent<Collider>();
354+
Collider objectCollider = grabbedObject.GetComponent<Collider>();
355+
if(
356+
Physics.ComputePenetration(playerCollider, playerCollider.transform.position, playerCollider.transform.rotation,
357+
objectCollider, objectCollider.transform.position, objectCollider.transform.rotation,
358+
out Vector3 direction, out float distance))
359+
{
360+
Vector3 warpPrediction = player.transform.position + direction * distance;
361+
if (distance > 5)
362+
{
363+
output += "\nWarp Prediction: " + warpPrediction.x.ToString("0.000") + ", " + warpPrediction.y.ToString("0.000") + ", " + warpPrediction.z.ToString("0.000");
364+
output += "\nWarp Distance: " + distance.ToString("0.000");
365+
}
366+
}
367+
368+
}
369+
370+
return output;
351371
}
352372
else
353373
{

0 commit comments

Comments
 (0)