- Home /
Moving Collider without moving the child
Hey, I've got a jumping animation that lifts my Playermodel into the air that's why i just want to move the Collider during the jump animation but if i change the transform.position of the Collider the Playermodel that is attached to the GameObject with the Collider moves up aswell. Is there a way to just move the Collider without moving the Playermodel?
Or is there any other approach i could take to adjust the playerhitbox with a jump animation aside from parenting the collider to the Playermodel?
The Code im using for the Collidermoving:
void jumping() { if(states.isJumping) { states.isJumping = false; controllerCollider.transform.position = new Vector3(controllerCollider.transform.position.x, controllerCollider.transform.position.y + 1, controllerCollider.transform.position.z); } }
Answer by JanWdm · Feb 11, 2018 at 08:52 PM
My bad i definded controllerCollider as collider and not as CapsuleCollider that im actually using. CapsuleCollider gives me the option to use center and height as i need. Solved
Your answer
![](https://koobas.hobune.stream/wayback/20220612152429im_/https://answers.unity.com/themes/thub/images/avi.jpg)