How to use mouse to choose a scaled GameObject

In my project,actually i use kinect to perform zoom,but i have completed zoom.
This is not the reason why i cann’t choose gameobject.
First,i need to scale GameObject,and i change localscale for scaling GameObject.
The code is like this:
Vector3 newLocalScale = new Vector3(zoomFactor, zoomFactor, zoomFactor);
transform.localScale = Vector3.Lerp(transform.localScale, newLocalScale, spinSpeed * Time.deltaTime);

Second,after i scaling the GameObject,i found that i cann’t choose the GameObject with mouse,The project uses bounds.IntersectRay for hitting gameobject.

Before zooming i can choose any gameobject with mouse,so i think the problem must be about localscale ,bounds or collider.

Third,i debug gameobect’s bounds and collider before and after zooming,and i also found that the scaled GameObject’s bounds and collider size are both not changed.

Who can help me solve this problem? Thank you very much

You may need to also scale up the Collider for the object.

1 Like

Thanks a lot,i’ll try it.

I wonder how can i scale collider,could you please tell me the details

i have tested ,before and after zooming bounds and collider are both not changed

Is it necessary to adjust localScale and not simply scale?
Looking back on the documentation, the colliders are sized to fit the gameObject’s scale.

What kind of collider are you using?

In the demo project,use Box Collider.i’ve not found collider of the developing project where it is.

Okay, I made a short script to test scaling of an object and the collider’s response to it.
When scaling a basic cube (with BoxCollider) through use of transform.localScale (just like your script), the collider scaled as necessary.

Can you perhaps post screenshots demonstrating the misaligned collider before and after scaling?
Also, a more complete copy of the code you’re using would help with spotting any logical errors.