Rotation of an Object yielding no results

Hello.

I have 3 copies of the same model. One has a default X rotation of 90, one has a default Y rotation of 90, and one has a default Z rotation of 90.

When instantiated in game, I default the rotation to the instantiated position’s rotation which looks like:

GameObject test = Instantiate(testObject, transform.position, transform.rotation) as GameObject;

As expected it spawns on the right point, and also as expected, it’s facing upwards.

Then I apply a one-shot rotation to it with a simple Transform.Rotate.

vector3 _spellDirection = viewDirection;

test.transform.Rotate(viewDirection, 270);

I’ve tried every number possible as the second parameter, and even without a second parameter. It doesn’t rotate. I’ve even tried it as part of a While() statement, and it fires, though doesn’t move at all.

What could possibly be the issue?

My goal is to get it to face towards a certain angle, but it won’t do anything but stand straight up on all instances of the models that I imported.

Thanks for any help… Probably a pretty simple answer, though I can’t get it to move at all.

Your Rotate code does work; you have some other issue. Try trouble-shooting, and just use this:

transform.Rotate (Vector3.up, 90);

Put that on a cube or something and it will rotate 90 degrees. However it would be more common to do:

transform.Rotate (Vector3.up * 90);

From your description, it sounds like maybe you should use Transform.LookAt though.