x


Rotating a Prefab?

hi im trying to rotate a prefab on X 90 but its not doing it ive tried using this

void Start ()
{
    transform.Rotate(90, 0, 0);
}

but its not doing it my object is a piece of tetris looking like this watching it from top

 ___
|   |
|___|

and i want it to look like this

 __
|  |
|  |
|  |
|  |
|  |
|__|

i have also tried modifying the prefab and i can modify scale but not rotation any help plz?

more ▼

asked Apr 30 '11 at 08:10 PM

Makenshi gravatar image

Makenshi
8 6 6 12

also the models im using are .fbx from 3dmax

Apr 30 '11 at 08:17 PM Makenshi
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Make sure you understand the difference between a prefab and a game object that's been instantiated (cloned) from that prefab.

With the above code, it's unlikely that you're actually 'rotating a prefab'. If however that script is attached to the prefab, then any game object cloned from the prefab should indeed be rotated 90 degrees as soon as its Start() function runs.

Keep in mind though that Start() only runs once, sometime before Update() is called for the first time. As such, in this case it'd probably make more sense simply to instantiate the game object with the desired orientation (rather than modifying it after the fact in the Start() function).

more ▼

answered Apr 30 '11 at 08:19 PM

Jesse Anders gravatar image

Jesse Anders
7.3k 7 17 48

yeah... the thing is i cant really do that it wont let me modify the rotation of the imported asset :S and i tried using it on the Start Function because i only need it to rotate once in X and then do whatever else it needs to

Apr 30 '11 at 08:22 PM Makenshi
(comments are locked)
10|3000 characters needed characters left

seems like initializing the rotation in 0 before implementing it on the Start did the job got no idea why but it worked tyvm for the help anyways

more ▼

answered Apr 30 '11 at 08:45 PM

Makenshi gravatar image

Makenshi
8 6 6 12

(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:

x2243
x231
x23

asked: Apr 30 '11 at 08:10 PM

Seen: 847 times

Last Updated: Apr 30 '11 at 08:10 PM