- Home /
Roatate animation starts from 0
Hi,
I have coins in game, out of 3 coins first one's Y rotation is 0 , second ones Y rotation is set to 60 and third ones Y rotation is set to 120
I have attach animation clip to it which rotates the coins.
But the thing is all coins rotate position gets set to 0 and they start to rotate from Y position at 0 .
How can I add that clip where all those three coins start to rotate from where there default position?
Answer by idurvesh · Nov 15, 2014 at 01:25 PM
Okay I able to make it on my own,
What I basically did is, Created empty object ,set its Y position rotation and then added coin to child of that object.
Answer by blueLED · Nov 15, 2014 at 09:33 AM
Your first keyframe for each coin has to be set to where you want them to start.
So if you want one to start at 60, you have to set the first keyframe to 60 on y rotation.
Maybe this would be easier done in code? Try it:
private float spinSpeed = 50.0f;
void Update() {
transform.Rotate(Vector3.forward, spinSpeed * Time.deltaTime);
}
Hi, Yes I was using that script previously but suppose scene has 30 coins at a time then the script gets expensive and freezes the game so I went for $$anonymous$$echanism ,but it provided fixed rotation...any other solution plz?
Well, normally you would instantiate the coins, right? Like in a mario level, there's hundreds of coins, it doesn't freeze does it.
Yeah but I dnt know why in my case in profiler it shown increasing calls count and fps dropped from 110 to 20
Your answer
Follow this Question
Related Questions
Mechanim and repositioning body parts help 0 Answers
Default Mecanim Rig 0 Answers
Animation Blending Problem.. 0 Answers
How do you remove root animation curves? 0 Answers
Animation only playing one time in Mechanim instead of over and over. 1 Answer