hy,
i’m absolutely new to unity, but i think its a brilliant tool.
so here what i’m planning to do:
i have 10 objects in a c4d file. now i want to make a kind of button in unity, which triggers an animation. so if the button is hit, the 10 objects start to get in a specific order. (the order is predetermined)
the part with the trigger is easy.
but, is it better to create the animations already in c4d and unity should play it (but is there a possibility, to tell unity, it should play from frame 50-60?, or is the better way to use the translate function?
but then, how can i give em a specific path to go in the order?
To answer your question: You can animate your objects completly inside C4d.
They import without any problem and you can define different animation sets for each file in the import settings by giving them a name and a frame range. Its very easy!
Just a hint: For bone based animation you need to bake the ik, when used. Fbx export for bone based animations only work from C4D R9.6 and R10.1 due to a bug in the exporter of C4d. So does direct import to Unity of native C4D Files.
thank you for your fast answer. so i imported a file, and selected two frame ranges. i called them “erster” and “zweiter”.
i wrote a script, the idea is, when the mouse hovers over a sphere, the animation “erster” should start.
heres the script:
function OnMouseOver(){
animation.Play(“erster”);
}
but i get the error message
“MissingComponentException: There is no “Animation” attached to the Sphere GameObject, but a script is trying to acces it”
so i think, the function for the animation works, but it doesnt know where it is. i looked if the “erster” and “zweiter” are somewhere but i can’t find them.
another thing is, that on my imported object, the prefab says there is no animation.
Animation: (none) animation clip.
Your imported file should have the erster and zweiter animation clips attached to it. If you put the script:
function OnMouseOver(){
animation.Play("erster");
}
On the sphere object it means “Play the animation on this object” not “Play the animation on the other object”. So, add a reference variable and assign it to an instance of your c4d import, like this:
// drag the object with the animation from the hierarchy pane to this variable in the inspector.
var other : GameObject;
function OnMouseOver(){
other.animation.Play("erster");
}
but i get already the next error. if i start the game engine, and try to hover the mouse, i get the error
the animation state erster could not be played because it couldnt be found.
hmm. but i did the import settings right, i think. but i don’t see the animations somewhere.
i attached you 2 screenshots, one of the import settings, and the other from the inspector.
This may or may not help, Its a different approach but in c4d, name your 2 files (not 1)“erster” and “zweiter”. Instead of splitting in the import settings box?
Or
drag your animation component (child of your c4d model) from the project window to the empty animation slot in the inspector.