- Home /
Problem with positioning of scaled models
Hi I have a model in my game that it should be 15 times of its size when I set the scales parameters to15 And in a script I set its position to position of another game object, I see there is a space between them, it means the position of these two aren't equal. And when its scale is 1 I don't have such a problem What's wrong? I use a simple line of code: transform.position=somegameobject.transform.position;
Answer by leSamo · Oct 24, 2017 at 05:25 PM
When using scaled objects you have to account, that world coordinates don't scale. Try multiplying the new position with object's scale:
transform.position=somegameobject.transform.position * somegameobject.transform.localScale.x;
Note that this only works if you have scaled the object by the same factor in every dimension (xScale = yScale = zScale)
Your answer
Follow this Question
Related Questions
Common Animation for all characters in unity 0 Answers
Place gameobject on ROI 0 Answers
unity 2d: scaling sprites problem. 1 Answer
Question about 2D to 3D,Sprite to 3D game objects 0 Answers
How can I set the default position of a 3D object? 2 Answers