Add sphere collider to height map

You can sometimes go straight through the mesh collider if you are fast enough. This sphere collider stops this from happening. Now you will bounce off the sphere collider.
This commit is contained in:
Noah Pilarski 2022-07-13 19:50:31 -04:00
parent 19e9bbf52a
commit 53cf5f5eee

View File

@ -70,6 +70,9 @@ namespace NewHorizons.Builder.Body
var cubeSphereMC = cubeSphere.AddComponent<MeshCollider>();
cubeSphereMC.sharedMesh = mesh;
var cubeSphereSC = cubeSphere.AddComponent<SphereCollider>();
cubeSphereSC.radius = Math.Min(module.minHeight, module.maxHeight);
var superGroup = planetGO.GetComponent<ProxyShadowCasterSuperGroup>();
if (superGroup != null) cubeSphere.AddComponent<ProxyShadowCaster>()._superGroup = superGroup;