Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by Bentoon · Dec 03, 2015 at 05:10 PM · animationanimator controllermodelsphoto

switching entire model each frame

Hello all,

I'm having a hard time wrapping my head around a simple idea :

I have a photogrammetry model where a figure is walking.

So there are 7 models making up a walk cycle.

How can I cycle through these?

Thanks

~be

Comment
Add comment · Show 7
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 Mako-Infused · Dec 03, 2015 at 05:19 PM 0
Share

I would recommend you use another method to animate the model. The method you are talking about using will cause significant strain on the cpu and gpu, due to the model having to be loaded with textures and then destroyed each single frame. I know this does not answer your question, but there are much better solutions available such as creating rigs and animations.

avatar image Bentoon Mako-Infused · Dec 03, 2015 at 07:29 PM 0
Share

Thanks,

Yes I agree, and I am rigging the model as well, but there are times when I will want this ability too...

Any ideas? Setting from rate to 8 fps

Thanks

!be

avatar image Mako-Infused Bentoon · Dec 03, 2015 at 11:46 PM 0
Share

Sure, I have some ideas. The default mecanim animation system built into Unity should be able to swap models during each animation frame. Just create a new animation and controller, start recording the animation and swap the mesh attached to the mesh rendererer. An alternative would be to hide/show particular mesh rendererers according to which model you want visible.

avatar image Cherno · Dec 03, 2015 at 08:31 PM 0
Share

You basically have to write a custom animator that uses custom classes for clips and frames. A frame would have information about the mesh that should be used, and how long the frame is (so it's not related to the frames that the program runs at). A clip would have an array of frames, and a name, and wether it is looped or not. The animator itself would have an array of clips in turn, and have function that play and stop clips via Coroutines. I have written such a system for my own project and added editor extensions so I can easily create animations in a custom window.

avatar image Bentoon Cherno · Dec 05, 2015 at 08:52 PM 0
Share

@cherno, @ JonathanCzeck Thanks guys ! Interesting I think John's script below would do that without having to use a coroutine:

avatar image JonathanCzeck Bentoon · Dec 05, 2015 at 08:58 PM 0
Share

Want to mark it answered then?

avatar image jmgek · Dec 04, 2015 at 03:50 AM 0
Share

I am actually dealing with something like this for a pixel based animation because I am creating voxel characters. I need to implement object pooling and each animation frame is about 1/4 a second. Bbut if it is a 3D model I would not even consider it, just animate in mechanism or third party ($$anonymous$$aya, Blender) etc or create a texture and swap out the textures every quarter second.

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by JonathanCzeck · Dec 04, 2015 at 10:55 AM

Just change the rendered mesh at runtime.

 using UnityEngine;
 
 [RequireComponent(typeof(MeshRenderer))]
 public class MeshCycler : MonoBehaviour {
     public float fps = 8f;
     public Mesh[] meshes;
 
     MeshFilter meshFilter;
 
     void Awake() {
         meshFilter = GetComponent<MeshFilter> ();
     }
 
     void Update () {
         int index = ((int)(Time.time * fps)) % meshes.Length;
         meshFilter.sharedMesh = meshes [index];
     }
 }
 

Is that what you want?

Comment
Add comment · Share
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
0

Answer by percycampos · May 03, 2017 at 08:43 AM

Hello.

I have been experimenting with this idea as well. I'm trying to animate multiple, different meshes ( in this case, an obj seq,) and I'm wondering if this is really optimal (for mobile.)

I understand there are Assets that can play obj seq's (MegaCache, which I own) but i can't seem to master .mtl libraries due to each obj having it's own unique material.

I was able to animate each obj with the mesh renderer, but do you know if this is optimal?

Thanks!

Comment
Add comment · Show 1 · Share
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 OmarVector · Jan 06, 2021 at 10:01 AM 0
Share

Did you find the answer? did it works fine on mobiles?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

51 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Import multiple models in runtime into Unity3d scene and make an animation sequence out of it 0 Answers

Animation Lag With Maximo? 1 Answer

Vehicle animation on a 2d map 0 Answers

the animation walk but he still in the same place and rotate left and right on this white circle 0 Answers

How can I create a home position where my character returns to after every animation? 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