Jittering when doing animations with PicaVoxel

0
MrGilbert posted this 03 June 2017

[Crosspost with Unity-Forums. I haven't thought about posting it here first, sorry!]

Hi folks,

I'm currently prototyping, and I have a issue I cannot solve, or better - I don't know what's happening.

Have a look at this video, and the feets starting at 00:17:

https://www.youtube.com/watch?v=CJlL7lo7lpU

Basically, I have some kind of jittering or glitch. Now, this is an animation made with MagicaVoxel, imported with PicaVoxel. PicaVoxel creates a mesh for every frame, and then displays them one after another.

This is how I currently move the character forward (basic script, found in the web some long time ago):

public class MoveForward : MonoBehaviour
{

public Rigidbody RigidBody;
public float movementSpeed = 2.0f;
public float clockwise = 250f;
public float counterClockwise = -250f;

void Start()
{

}

void Update()
{

     transform.position += transform.forward * Time.deltaTime * movementSpeed;

    if (Input.GetKey(KeyCode.S))
    {
        RigidBody.position -= transform.forward * Time.deltaTime * movementSpeed;
    }
    else if (Input.GetKey(KeyCode.A))
    {
        RigidBody.position -= transform.right * Time.deltaTime * movementSpeed;
    }
    else if (Input.GetKey(KeyCode.D))
    {
        RigidBody.position += transform.right * Time.deltaTime * movementSpeed;
    }

    if (Input.GetKey(KeyCode.E))
    {
        transform.Rotate(0, Time.deltaTime * clockwise, 0);
    }
    else if (Input.GetKey(KeyCode.Q))
    {
        transform.Rotate(0, Time.deltaTime * counterClockwise, 0);
    }
}
}

I'm wondering: What causes this "jitter", and how could I get rid of it?

2 Comments
Order By: Standard | Newest | Votes
0
GarethIW posted this 04 June 2017

How interesting, I've never noticed anything like this before.

Looking at the video, it does appear that only the feet are jittering, but it looks like the feet are part of the whole body (i.e. you're not using a child volume for the feet). So that means it's definitely something with the frame animation that's jittering.

Off the top of my head, I'm thinking this has something to do with animation timing and frame updates. In PicaVoxel/Scripts/BasicAnimator.cs, try changing the Update() method on line 59 to FixedUpdate().

If that doesn't work, I'll need to have a play with it myself to help further. If you could send either a zip of your whole project, or an AssetPackage with just the character and scripts as a prefab to support@picavoxel.com I'll take a look.

edit: Let me know if you send an email, sometimes things get lost in junk.

Last edited 06 June 2017

0
MrGilbert posted this 2 weeks ago

Sorry,

I just realized that I never replied. Better late than never, huh? At the end, it was just a prototype. I think I tried the fixed update back then, but it didn't help.

But I'm about to experiment with it again, this time I would like to achieve the good old 2d animation effect, but with a third dimension. Don't know how it looks or works. We'll see. But I will use the same movement space like the animation does, that should work better (hard to explain).

Thanks for your reply, though. :)


Our 103 members have posted 431 times in 104 discussions