- Home /
Is there any good method to keep the collider constant while the local scale shrinking or expanding
I have a button game object which attached a box collider. Now I want to make my collider to keep constant when the button is shrinking or expanding. I know i can update the collider size in the Update()to force the collider keep constant.But I want to know if there is any other good way to do that or is there any way to get the animation curves at the run time.
Answer by Coderdood · May 28, 2013 at 04:49 AM
The only suggestion I have - other than updating the collider size when you scale the object is to separate the visual representation of the button from the collision.
For example you probably have it setup now as just one game object "Button". I suggest instead having your button be a composite of the visual and collision elements:
ButtonObject
- VisualElements
- Collision
With the object being made up of three separate objects you get a lot of power. When you move / scale ButtonObject you move / scale both the visuals and the collision object. But you can also move / scale either the visual or collision elements separately from each other.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
collider animation 1 Answer
Unity 4.5.2 bug changing the properties of the 2d colliders in animation 1 Answer
How to give animation to the on gui button? 1 Answer
Animation pause on button press? 1 Answer