create visuals for collision objects

This commit is contained in:
in0finite 2022-02-27 01:03:22 +01:00
parent 706d2b6d9d
commit 18e5ec830a

View file

@ -14,6 +14,7 @@ namespace SanAndreasUnity.Behaviours.World
[SerializeField] private bool m_createCollisionObjects = false;
[SerializeField] private float m_collisionHeight = 20f;
[SerializeField] private bool m_createVisualsForCollisionObjects = false;
[HideInInspector] [SerializeField] private List<Transform> m_renderingObjects = new List<Transform>();
[HideInInspector] [SerializeField] private List<Transform> m_collisionObjects = new List<Transform>();
@ -200,6 +201,14 @@ namespace SanAndreasUnity.Behaviours.World
F.DestroyEvenInEditMode(meshCollider.sharedMesh);
meshCollider.sharedMesh = mesh;*/
if (m_createVisualsForCollisionObjects)
{
var visualGo = GameObject.CreatePrimitive(PrimitiveType.Cube);
Destroy(visualGo.GetComponent<BoxCollider>());
visualGo.transform.SetParent(go.transform, false);
visualGo.transform.localScale = size;
}
m_collisionObjects.Add(go.transform);
i++;