public override bool WriteToJson(GameObject obj, Component component, MyJson_Object compJson) { SphereCollider comp = component as SphereCollider; var sphereItem = new MyJson_Array(); sphereItem.AddNumber(comp.center.x); sphereItem.AddNumber(comp.center.y); sphereItem.AddNumber(comp.center.z); sphereItem.AddNumber(comp.radius); compJson.Add("sphere", sphereItem); return(true); }
public override bool WriteToJson(GameObject obj, Component component, MyJson_Object compJson) { BoxCollider comp = component as BoxCollider; var halfSize = comp.size * 0.5f; var minimum = comp.center - halfSize; var maximum = comp.center + halfSize; MyJson_Array aabbItem = new MyJson_Array(); aabbItem.AddNumber(minimum.x); aabbItem.AddNumber(minimum.y); aabbItem.AddNumber(minimum.z); aabbItem.AddNumber(maximum.x); aabbItem.AddNumber(maximum.y); aabbItem.AddNumber(maximum.z); compJson.Add("aabb", aabbItem); return(true); }