Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with setScale() and collider detection #2028

Open
SteveGreatApe opened this issue Dec 20, 2018 · 2 comments
Open

Problem with setScale() and collider detection #2028

SteveGreatApe opened this issue Dec 20, 2018 · 2 comments
Labels

Comments

@SteveGreatApe
Copy link

I've got an object in my scene where I control it's size using setScale. I've also got a Collider on this object. I've found I'm having problems getting the pickers nearest object detection to work when this object is in front of another object with a Collider.

What I think is happening is that the calculated distance used to determine the nearest object is also getting mapped by the scale. So for instance if an object is 2 units away, and has a scale of 0.5, then the distance gets divided by 0.5 giving a total of 4, which is the effective distance allowing for scaling.

So if there's another object 3 units away with a normal scale of 1, this gets given a distance of 3 so the Picker thinks it's nearer and returns a hit on this object, not the scaled object that is actually closer.

@mpolsz
Copy link

mpolsz commented Mar 1, 2019

We had similar problem in our app. What we found out is that MeshCollider returns distance for raycast in mesh coordinates not in world (Sphere and Box colliders returns distance in world coordinates). I made quick fix in our fork #2033 but someone from core team should look into this issue.

@liaxim
Copy link
Contributor

liaxim commented Mar 1, 2019

@NolaDonato Please take a look

@liaxim liaxim added the bug label Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants