mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Make concave colliders work
This commit is contained in:
parent
0779ab41d5
commit
2c5b4c754c
@ -33,6 +33,9 @@ namespace NewHorizons.Builder.General
|
||||
owRigidBody.SetValue("_maintainOriginalCenterOfMass", true);
|
||||
owRigidBody.SetValue("_rigidbody", rigidBody);
|
||||
owRigidBody.SetValue("_kinematicRigidbody", kinematicRigidBody);
|
||||
owRigidBody._origParent = GameObject.Find("SolarSystemRoot").transform;
|
||||
owRigidBody.EnableKinematicSimulation();
|
||||
owRigidBody.MakeKinematic();
|
||||
|
||||
ParameterizedAstroObject astroObject = body.AddComponent<ParameterizedAstroObject>();
|
||||
|
||||
@ -50,7 +53,7 @@ namespace NewHorizons.Builder.General
|
||||
astroObject.SetValue("_primaryBody", primaryBody);
|
||||
|
||||
// Expand gravitational sphere of influence of the primary to encompass this body if needed
|
||||
if(primaryBody?.gameObject?.GetComponent<SphereCollider>() != null && !config.Orbit.IsStatic)
|
||||
if (primaryBody?.gameObject?.GetComponent<SphereCollider>() != null && !config.Orbit.IsStatic)
|
||||
{
|
||||
var primarySphereOfInfluence = primaryBody.GetGravityVolume().gameObject.GetComponent<SphereCollider>();
|
||||
if (primarySphereOfInfluence.radius < config.Orbit.SemiMajorAxis)
|
||||
@ -64,7 +67,7 @@ namespace NewHorizons.Builder.General
|
||||
alignment.SetValue("_usePhysicsToRotate", true);
|
||||
}
|
||||
|
||||
if(config.Base.CenterOfSolarSystem)
|
||||
if (config.Base.CenterOfSolarSystem)
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => Locator.GetCenterOfTheUniverse()._staticReferenceFrame = owRigidBody, 2);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user