• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
This question was closed Apr 21, 2016 at 08:01 PM by Le-Pampelmuse for the following reason:

The question is answered

avatar image
0
Question by IonoI · Apr 18, 2016 at 12:23 PM · animationmeshcolorrenderer

why do animated objects not behave like normal GameObjects?

I imported an FBX file that has an animation attached to it. I made it into a prefab and managed to add some of the regular GameObject components like character controller, script, rigidbody, mesh renderer... I can make it move and scale, but not change it's color. Also tried to fix the rotation through the inpsector transform tab but it didnt do anything. When I added a mesh filter it looked like this: http://puu.sh/om8fu.jpg

How can I make it animate and color the same mesh? I want to use

 rend = GetComponent<Renderer>();
 rend.material.color = color;//set color

to affect the part that's being animated and not add a new mesh.

We want the colored worms to be flat on the ground and animate (curve like the white part), without the white part being there.

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Le-Pampelmuse · Apr 18, 2016 at 01:18 PM 2
Share

Hi, there are a few gaps of information.

  • Why do you add a mesh renderer and a mesh filter to a fbx model?
    When importing a fbx mesh those components should already be there, otherwise you wouldn't see the meshes.

  • The character controller works without a rigidbody.
    Don't manually add one to the same GameObject. Check the docs. http://docs.unity3d.com/$$anonymous$$anual/class-CharacterController.html

  • Did you check if Unity imports the animation from the fbx file?

  • Why are there two worms perpenticular to each other? Is this wanted?


Q: How can I make it animate and color the same mesh?

A: Google: "Unity how play animations" & "Unity how to change mesh renderer color"


I want to use

  rend = GetComponent<Renderer>();
  rend.material.color = color;//set color

to affect the part that's being animated and (1) not add a new mesh.

Just make sure that "rend" is referring to the mesh renderer you want to assign a new color to.

(1) I don't know what you mean by that, you are not adding a new mesh with those two lines of code.

avatar image IonoI Le-Pampelmuse · Apr 18, 2016 at 07:29 PM 0
Share

I think i fixed it, but it's probably not in the best way. And no, we don't want 2 perpendicular worms, just 1 that's flat on the floor.

when I import the fbx file it has the animation (Take 001) and a mesh (Line001): http://puu.sh/on9qi.png

but when I drag it into the hierarchy then into the prefab folder to make a prefab where I can add scripts and other components some things dissapear: http://puu.sh/on9AC.png

I kinda made it work by adding a skinned mesh renderer in the Line001 and calling it using rend = GetComponentInChildren<Renderer>();

The rest of the components and the script are in CP1. If i disable the renderer or move it to CP1 it doesnt work. The animator uses the animation file from the non prefab version of CP1.

now it looks like this: http://puu.sh/onajG.jpg, the only problem is that they're moving sideways. I tried to rotate it in 3ds max, as well as in unity by 90 degrees around the y axis.

Show more comments
avatar image IonoI · Apr 21, 2016 at 12:46 AM 0
Share

thanks, it seems to work now. I at least understand it this much now

avatar image Le-Pampelmuse IonoI · Apr 21, 2016 at 08:01 PM 2
Share

This isn't an answer. ;) Please post answers/solutions as "answers", the rest as comments. Check the user guide if you are not sure. I've converted it to a comment.

Glad I could help!

0 Replies

  • Sort: 

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Maya Vertex Animation import 1 Answer

How to Avoid splitting Normals on Geometry with blendshapes 0 Answers

Skinned mesh to mesh and vice-versa 0 Answers

How do you add a material and change the size in Mesh Renderer in C# scripting? 1 Answer

I have a problem with skinned render mesh on Android. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges