- Home /
Question by
Orloffyeah · Jun 16, 2013 at 12:33 AM ·
animationcollidermovebox
How to move BoxCollider with animation?
Hi, what is happening is that I had set-up a character that jump when I added force to its rigidbody, but when I added the animation, the model goes higher than the box collider. How could I make it so that the collider "follows" the model?
This is part of the code that I use for the jump:
public Animator Runner_Controller;
private bool touchingPlatform;
private Vector3 startPosition;
void Start () {
GameEventManager.GameStart += GameStart;
GameEventManager.GameOver += GameOver;
GameEventManager.GameWin += GameWin;
startPosition = transform.localPosition;
gameObject.SetActive(false);
Runner_Controller.SetBool("Jumping",false);
}
void Update () {
if(Input.GetButtonDown("Jump")){
if(touchingPlatform){
rigidbody.AddForce(jumpVelocity, ForceMode.VelocityChange);
Runner_Controller.SetBool("Jumping",true);
touchingPlatform = false;
}
Comment
Answer by iwaldrop · Jun 16, 2013 at 01:15 AM
It sounds like you need to remove the translation keys from your animation.
Your answer
Follow this Question
Related Questions
How to move BoxCollider2D so it covers a line renderer? 0 Answers
Box Collider not moving with animation 1 Answer
Internal collisions 1 Answer