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?

1 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


Our 330 members have posted 404 times in 96 discussions