- Home /
The question is answered by OP
Local animation at origin (0, 0, 0)
Of course legacy's going to eventually be phased out so I want to figure this out. I can get this to work in legacy no problem, keep in mind.
I created a rotating heart that I want to animate at a particular location but it keeps moving to (0, 0, 0) when I play it. Here's what I tried:
I created a parent object and attached the prefab to it with no luck.
I created another parent and attached THAT parent object to it, again, with no luck.
I then created a parent object, attached the prefab, then added all of the animations and controller stuff to the parent object. Again, everything just goes to (0, 0, 0).
I also tried grouping models in Max 2013 which didn't work.
I tried linking parent and child objects together in Max which didn't work.
I checked to make sure there were no keyframes recorded in Max for position.
I messed around with every setting possible in the animation tab (Legacy worked, as I said).
And lastly, I even tried edited the location with scripting in LateUpdate.
Everything I found concerning it said to switch to legacy and parent the import. There was one post that said this method is no longer possible. So yeah, I get angry when I can't figure things out so this time I actually got to the point where I needed to ask for help, lol...
Anyway, thanks in advance.
Answer by zafadadynamic · Oct 21, 2013 at 10:26 PM
Well, I knew this would happen. This is how it always happens. RIGHT when I ask a question, I fix it. Here's exactly what I did without choosing legacy:
I created this script:
#pragma strict
var localOrigin : GameObject;
function Start () {
transform.position = localOrigin.transform.position;
}
function LateUpdate () {
transform.position = localOrigin.transform.position;
}
After I created the script, I created the parent object which included a box collider.
I then added the object I'm animating to the parent object.
Then I added the animation clip by dragging it onto the object I'm animating. Unity prompted me to save a controller, which I did.
The last step was dragging this script onto the animated object and adding the parent gameobject to localOrigin.
When I disable the script, the animated object returns to the origin.
Well, still I have to say thanks lol
If any of you know a way around this for Unity 4, let me know.
Follow this Question
Related Questions
Animation won't play as Generic but it does as Legacy, I need to use Generic, how can I fix this? 2 Answers
Why Do Legacy Animations Always Snap? 0 Answers
blender to unity animation problem 1 Answer
importing legacy animation fbx with mask 0 Answers
Character Change its Position When Animation Apply on It 0 Answers