This commit is contained in:
JohnCorby 2023-02-03 13:40:21 -08:00
parent cf2f45b6a7
commit e45a4d1c3c
2 changed files with 8 additions and 6 deletions

View File

@ -232,7 +232,7 @@ namespace NewHorizons.Builder.Props
if (!detail.keepLoaded) GroupsBuilder.Make(prop, sector); if (!detail.keepLoaded) GroupsBuilder.Make(prop, sector);
prop.SetActive(true); prop.SetActive(true);
if (detail.hasPhysics || true) if (detail.hasPhysics)
{ {
var addPhysics = prop.AddComponent<AddPhysics>(); var addPhysics = prop.AddComponent<AddPhysics>();
addPhysics.Sector = sector; addPhysics.Sector = sector;
@ -428,14 +428,15 @@ namespace NewHorizons.Builder.Props
if (!Sector) if (!Sector)
Logger.LogError($"Prop {name} has physics but no sector! Will fall through things when surrounding area is unloaded"); Logger.LogError($"Prop {name} has physics but no sector! Will fall through things when surrounding area is unloaded");
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(.1f);
var parentBody = GetComponentInParent<OWRigidbody>(); var parentBody = GetComponentInParent<OWRigidbody>();
// just disable all non triggers // hack: make all mesh colliders convex
foreach (var collider in GetComponentsInChildren<Collider>(true)) // triggers are already convex but whatever
if (!collider.isTrigger) // prints errors for non readable meshes but whatever
collider.enabled = false; foreach (var meshCollider in GetComponentsInChildren<MeshCollider>(true))
meshCollider.convex = true;
var bodyGo = new GameObject($"{name}_Body"); var bodyGo = new GameObject($"{name}_Body");
bodyGo.SetActive(false); bodyGo.SetActive(false);

View File

@ -232,6 +232,7 @@ namespace NewHorizons.External.Modules
/// <summary> /// <summary>
/// Should this object dynamically move around? /// Should this object dynamically move around?
/// This tries to make all mesh colliders convex, as well as adding a sphere collider in case the detail has no others.
/// </summary> /// </summary>
public bool hasPhysics; public bool hasPhysics;