So I am trying to set up my collider’s Center and Size:
WHY?
They’re missing its original size and possition settings, so they appear far away, at a wrong size
Ok how am i trying to set it?
private void Start()
{
AddNonTriggerBoxColliderCollider();
}
private void AddNonTriggerBoxColliderCollider()
{
Collider myBoxCollider = gameObject.AddComponent<BoxCollider>();
myBoxCollider.isTrigger = true;
//myBoxCollider.center = new Vector3(-35.8, 2.14, -43.1);
//myBoxCollider.size = (10.5, 1.57, 8.27);
}
edit: This is how it looks in Visual Studio when the compiler complains:
How should I be doing it instead?
I’ve been investigating online but people seem to do a GetComponent after adding it… but it just doesn’t feel right, I would like to create the collider with the right settings. Is that possible? Or what would be the most correct way to do this?