- Home /
Trouble rotating a prefab while it's moving up,Rotating an object with an animation while it moves up
Hey guys, I'm brand new to Unity (started learning this morning) and I'm having an issue animating a sprite/prefab while it's moving.
I have a prefab that gets spawned and I want it to constantly be spinning around while also moving up.
I created the animation for it and it's spinning properly when I run the animation, but when the prefab actually spawns with that animation it doesn't work properly because it's also moving up.
I assume it's because as it rotates, "up" doesn't become up when the top of the prefab is rotating.
The code that I'm using to make the prefab constantly move up is:
transform.Translate(0.0f, 0.02f, 0.0f);
For the animation, I added a Rotation property and at 0:00 its Rotation.z
is 0 and at 0:30 its Rotation.z
is 360.
The animation looks great when I run it, but not combined with the movement.
Any assistance would be great. Thanks!,Hey guys, I'm brand new to Unity (started learning this morning) and I'm having an issue animating a sprite/prefab while it's moving.
I have a prefab that gets spawned and I want it to constantly be spinning around while also moving up.
I created the animation for it and it's spinning properly when I run the animation, but when the prefab actually spawns with that animation it doesn't work properly because it's also moving up.
I assume it's because as it rotates, "up" doesn't become up when the top of the prefab is rotating.
The code that I'm using to make the prefab constantly move up is:
transform.Translate(0.0f, 0.02f, 0.0f);
For the animation, I added a Rotation property and at 0:00 its Rotation.z
is 0 and at 0:30 its Rotation.z
is 360.
The animation looks great when I run it, but not combined with the movement.
Any assistance would be great. Thanks!
Your answer
Follow this Question
Related Questions
Rotate a child bone during animation? 1 Answer
Animation rotations are not rotating in the right direction. 1 Answer
How do I rotate something smoothly? 2 Answers
Rotate Animation In-Game? 2 Answers
Ellipse Animation by code 2 Answers