- Home /
transform.position error
gun.position = Vector3 (0.9,-0.49,0.38);
I am using this code to move a transform to the position above
whenever I play the scene it moves it a different location usually (2.8,-5.1,0.9)
there is not pattern between the position I enter and the position which it moves to?
Wat are possible reasons for this?
If you force it to the position Vector3(0.9, -0.49, 0.38) and does not stay there, then it is possible that you move it elsewhere in your code.
Answer by alienx2 · Jan 10, 2011 at 04:31 PM
hmm how about this manual code:
gun.transform.position.x = <place a number>;
gun.transform.position.y = <place a number>;
gun.transform.position.z = <place a number>;
i think i havent try that problem.. hehehe
I solved the problem by putting the gun in the place I needed and just using
gun.rendered.enabled = false; when it wasn't supposed to be there, but the error i had is still odd
Also i tried the manual method, still didn't work >.<
I did try your answer, I was getting the same problems.
Answer by 3dDude · Jan 10, 2011 at 03:54 PM
Well, You could try gun.localPosition... Other then that I'm not really sure.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094814im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Return Enemy To Start Position 1 Answer
Animation Clobbers Position 2 Answers
If gameobject moves do this 1 Answer
transform.position error 1 Answer
transform.position on basis of rotation 0 Answers