mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
idk
This commit is contained in:
parent
9c76cd8402
commit
6cd6034558
@ -394,31 +394,30 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: simulate in sector
|
||||||
|
// BUG: detector collider is not included in groups
|
||||||
private class AddPhysics : MonoBehaviour
|
private class AddPhysics : MonoBehaviour
|
||||||
{
|
{
|
||||||
private IEnumerator Start()
|
private IEnumerator Start()
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(.1f);
|
yield return new WaitForSeconds(.1f);
|
||||||
|
|
||||||
var parentBody = GetComponentInParent<OWRigidbody>();
|
var parentBody = GetComponentInParent<OWRigidbody>();
|
||||||
|
|
||||||
foreach (var meshCollider in GetComponentsInChildren<MeshCollider>(true))
|
foreach (var meshCollider in GetComponentsInChildren<MeshCollider>(true))
|
||||||
{
|
// hack. doesnt work for all meshes but seems to for most
|
||||||
meshCollider.convex = true;
|
if (!meshCollider.isTrigger)
|
||||||
}
|
meshCollider.convex = true;
|
||||||
|
|
||||||
var go = new GameObject($"{name}_Body");
|
var owRigidbody = gameObject.AddComponent<OWRigidbody>();
|
||||||
go.transform.position = transform.position;
|
|
||||||
go.transform.rotation = transform.rotation;
|
|
||||||
transform.parent = go.transform;
|
|
||||||
|
|
||||||
go.layer = LayerMask.NameToLayer("PhysicalDetector");
|
|
||||||
go.AddComponent<SphereCollider>();
|
|
||||||
var owRigidbody = go.AddComponent<OWRigidbody>();
|
|
||||||
go.AddComponent<DynamicForceDetector>();
|
|
||||||
go.AddComponent<DynamicFluidDetector>();
|
|
||||||
owRigidbody.SetVelocity(parentBody.GetPointVelocity(transform.position));
|
owRigidbody.SetVelocity(parentBody.GetPointVelocity(transform.position));
|
||||||
owRigidbody.SetMass(0.0001f);
|
|
||||||
|
var detector = new GameObject("Detector");
|
||||||
|
detector.transform.SetParent(transform, false);
|
||||||
|
detector.layer = LayerMask.NameToLayer("AdvancedDetector");
|
||||||
|
detector.AddComponent<SphereCollider>();
|
||||||
|
detector.AddComponent<DynamicForceDetector>();
|
||||||
|
detector.AddComponent<DynamicFluidDetector>();
|
||||||
|
|
||||||
Destroy(this);
|
Destroy(this);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user