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
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 thats all simple.
Itβs for others who come here from google for help