Edit colliders center Unity

Hello guys, how do i edit a capsule colliders center, i saw the thing in unity documentation, it says, vector3.one which edits all the xyz center, i juz want my y center to be 1. I tried using vector3.up = 1, col.center.y = 1
col is the collider reference :wink:

SO any ideas :!: :grin:

col.center = Vector3(0f,1f,0f); in unityscript
col.center = new Vector3(0f,1f,0f) in C#

I am assuming i mean col.center = Vector3.up; should also work

thats ok i got it working, here is the code,

public vector3 collidercenter;
private CapsuleCollider col;


void start(){
col = GetComponent<CapsuleCollider>();
collidercenter = col.center;

}

void Update(){
col.center = collidercenter;

if (a conditon which i like, anything that wants the center to change){

col.center = vector3.zero

}

}

}

The thing it really does is it creates a vector3 collidercenter object and give it the vector 3 things at start. You can remove the code from start and also edit it in the inspector. Now after that i say it to update every frame to be the thing it captured at the start, and if the condition is true then change it to be zero :smile: thats all simple.

It’s for others who come here from google for help

1 Like

thanks but i got my own answer, i don’t know if it is long…