x


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?

more ▼

asked Jan 10 '11 at 03:47 PM

AtomicMarine gravatar image

AtomicMarine
587 46 57 77

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.

Jan 10 '11 at 03:54 PM Ejlersen
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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

more ▼

answered Jan 10 '11 at 04:31 PM

alienx2 gravatar image

alienx2
76 5 5 12

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 >.<

Jan 10 '11 at 09:01 PM AtomicMarine

Is there any reason you did not try my answer?

Jan 10 '11 at 11:09 PM 3dDude

I did try your answer, I was getting the same problems.

Jan 25 '11 at 04:32 AM AtomicMarine
(comments are locked)
10|3000 characters needed characters left

Well, You could try gun.localPosition... Other then that I'm not really sure.

more ▼

answered Jan 10 '11 at 03:54 PM

3dDude gravatar image

3dDude
2.8k 69 80 105

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2965
x1870
x1313

asked: Jan 10 '11 at 03:47 PM

Seen: 766 times

Last Updated: Jan 10 '11 at 03:47 PM