SchultzGames
Para tirar dúvidas, crie um tópico especifico na área "Dúvidas em Geral" e aguarde ser respondido. Evite comentar em tópicos não relacionados a sua dúvida :D
TÓPICOS RECENTES:
Tópico:
Postado em:
Postado por:
ShapeKeys do Blender para a Unity altera áreas próximas
COMO EVITAR QUE UM OBJETO (PLAYER,ITEM ETC...) ATRAVESSE UMA PAREDE.
Ajuda em Script de Verificação de Ação e Reação
unity Failed to load PlayerSettings (internal index #0). Most likely data f
modelar avatar e skins para um jogo web
PRECISO FAZER QUE MEU GAME FIQUE ONLINE
Materiais do Blander não aparecem no MeshRendere do Objeto na Unity
Repetiçoes de Textura no Terreno
SERVER IS DOWN - UNITY+MSQL
Procuro programadores - Novo jogo
Problema com o MS VEHICLES
Preciso de ajuda com a Unity
Problema com vídeo em 360° na Unity
Problemas no MS Vehicles
unity- eventos na Animação com Armature/Bones vinda do blender não funciona
ajuda exibir resultados simulados em uma liga Game Unity
Unity - ParticleSystem não é redirecionado no rawimage no canvas
Como resolver o problema de "face orientation" no Blender.
[DÚVIDA] Tive um problema com meu Canvas
erro na Directional Light
Problemas com o Directional Light da Unity 3D
210 Linhas de código para inimigo é muito grande?
Novo jogo da franquia Sphere game em desenvolvimento
malha da roda não girando com wheel collider unity
Problemas com ambiguidade
Touch mobile
INVALID TOKEN
Como acessar o "HD Render Pipeline" do HDRP por script?
CHAT GPT PRA JOGO DE TIRO? comentem
Tutorial script inimigo segue e foge do player
Ainda vale a pena lançar Asset na Asset Store?
Ajuda com tabela de historico de pontuaçao.
[TUTORIAL] Entrar no carro estilo GTA
Como derrapar um Whell Collider
Como altertar o valor do "Asymptote Value" do Whell Collider via Script
Preciso de ajuda para substituir valor de variavel em outro script
Ajuda com Top Down Shooter utilizando Photon
Duvida com Netcode
[RESOLVIDO] Unity - Movendo a Câmera na Horizontal/Vertical com Touch
Alguém me ajuda com os anúncios pfv
Segundo Trailer do jogo Dark Age, Feliz Natal a todos!
Unity - ScrollRect, Viewport, Content - O Conteúdo ñ inicia no topo
Coleta de itens
Unity - Cadastro do email do jogador
[GRATIS] PACK DE MODELOS 3D PARA JOGO DE TERROR
Onde Conseguir músicas para meu Jogo?
error CS0246 em Script
Alguem teve ja esse problema?
[Projeto em Andamento] Draug, um jogo de hordas
DISPONIVEL PARA FAZER MODELOS 3D
Unity-Loja.Como os Jogadores terão acesso aos ítens comprados na PlayStore?
Bugando depois do Build.
Primeiro Trailer do jogo Dark Age
Problema com sombra
Mesh e Material do objeto trocando para uma instancia no inicio do jogo
[RESOLVIDO] Unity - RawImages_Layer_Camera
INVESTIMENTO EM JOGOS E BANCO DE TALENTO
Teaser do meu novo projeto pessoal, Dark Age
Preciso de ajuda com mudança para mobile androide.
[RESOLVIDO] Posição final do objeto em jogo 2D
Input.GetAxis() obedercer a orientação de um objeto.
Interação com elementos UI
Meu primeiro jogo na steam
Minimap/Radar/GPS Estilo GTA V
[RESOLVIDO] Erro no console depois que formatei o pc
PACK GRÁTIS de Músicas ELETRÔNICAS para ajudar vocês em seus Jogos Indies!
[TUTORIAL] Entenda como funciona: ENUM, SWITCH, BREAK, CASE no C#
O Labirinto II - Baixe o Jogo
Qual e o codigo de Botões na unity para saber seus estados?
Como carregar itens pequenos dentro do carro sem que atravesse os colliders
[Duvida] Script pegar itens
Travamento ao trocar de cena
Colisão zoada e movimentação
Salvar objetos que foram destruidos entre cenas na unity
Quero começa a desenvolver um jogo de luta porem eu queria aprender a faze
Pegar qual objeto colidiu com o Linecast.
movimentação e camera?
[RESOLVIDO] Unity - SceneManager.LoadScene abre scene com objeto "vazio"
[RESOLVIDO] ajuda sobre skybox
MEU SIMULADOR DE CARRO
[_____IMPORTANTE_____] ALTERAÇÕES NA POLÍTICA DE COBRANÇA DA UNITY
[RESOLVIDO] Ausencia da funçao NavMesh na Unity 2022.2.12
[_____IMPORTANTE_____] ALTERAÇÕES NA POLÍTICA DE COBRANÇA DA UNITY - 2
Roll Up Um jogo de aventura e desáfios
Terminologia da Unity em outras engines
Como criar a iluminação do Sol no Sistema Solar?
Conexão de lobby pelo OnConnectedToMaster
Problema na exportção de projeto unity
[RESOLVIDO] Unity - Áudios estão emitindo som só Depois do Botão ser solto
Unity - Banco de Dados Online junto ao Jogo
Player virar para o inimigo(Prefab)
[TUTORIAL] Sistema De Save Game Ao Sair Da Fase
Problema de Sincronização de um objeto de um jogo multiplayer usa q Photon
Unity - Compartilhar meu Jogo
Alguém que manja do Google ADmob?
Unity - Avaliar meu Jogo
[RESOLVIDO] Destruir inimigo com o player.
Salvar e carregar dados na Unity de objetos prefabs sem sobrescrever os dad
Unity - Salvar os Dados do Jogador Online
Ontem à(s) 10:09 pm
Dom Mar 10, 2024 2:30 pm
Sex Mar 01, 2024 1:27 pm
Qui Fev 22, 2024 9:57 pm
Qua Fev 21, 2024 10:39 am
Ter Fev 20, 2024 9:28 am
Ter Fev 20, 2024 12:15 am
Seg Fev 19, 2024 1:06 pm
Seg Fev 12, 2024 1:56 pm
Seg Fev 12, 2024 1:17 pm
Dom Fev 11, 2024 8:55 pm
Dom Fev 11, 2024 11:16 am
Seg Fev 05, 2024 4:18 pm
Dom Fev 04, 2024 9:39 pm
Qua Jan 31, 2024 11:59 pm
Ter Jan 30, 2024 7:37 pm
Ter Jan 23, 2024 6:33 pm
Dom Jan 21, 2024 6:03 pm
Sáb Jan 20, 2024 7:03 pm
Sáb Jan 20, 2024 6:58 pm
Sáb Jan 20, 2024 6:39 pm
Sex Jan 19, 2024 1:29 pm
Sex Jan 19, 2024 8:40 am
Dom Jan 14, 2024 5:30 pm
Qua Jan 10, 2024 10:29 pm
Qua Jan 10, 2024 8:55 pm
Qua Jan 10, 2024 7:14 pm
Ter Jan 09, 2024 3:55 pm
Ter Jan 09, 2024 8:04 am
Sáb Jan 06, 2024 8:02 pm
Sex Jan 05, 2024 7:01 am
Sex Jan 05, 2024 12:12 am
Qui Jan 04, 2024 6:55 pm
Qui Jan 04, 2024 12:52 pm
Qui Jan 04, 2024 4:34 am
Ter Jan 02, 2024 11:48 pm
Dom Dez 31, 2023 7:25 pm
Qua Dez 27, 2023 5:44 pm
Qua Dez 27, 2023 3:08 pm
Sáb Dez 23, 2023 7:27 pm
Sáb Dez 23, 2023 5:06 pm
Qui Dez 21, 2023 8:10 pm
Seg Dez 18, 2023 2:04 pm
Sex Dez 15, 2023 5:11 pm
Qui Dez 14, 2023 9:13 pm
Qui Dez 14, 2023 2:47 pm
Qui Dez 14, 2023 1:48 pm
Qua Dez 13, 2023 8:58 pm
Ter Dez 12, 2023 2:32 pm
Seg Dez 11, 2023 1:53 pm
Qua Dez 06, 2023 8:13 pm
Sáb Dez 02, 2023 8:06 pm
Qui Nov 30, 2023 7:49 am
Seg Nov 27, 2023 1:35 am
Qua Nov 22, 2023 7:37 am
Qui Nov 09, 2023 1:22 pm
Seg Nov 06, 2023 11:59 am
Ter Out 31, 2023 9:53 am
Dom Out 29, 2023 8:05 pm
Dom Out 29, 2023 3:03 am
Sex Out 27, 2023 3:43 pm
Sex Out 27, 2023 3:28 pm
Qua Out 25, 2023 1:20 pm
Seg Out 23, 2023 10:34 am
Dom Out 22, 2023 6:55 pm
Qui Out 19, 2023 11:57 pm
Qui Out 19, 2023 6:39 pm
Ter Out 17, 2023 6:37 pm
Ter Out 17, 2023 6:18 pm
Seg Out 16, 2023 1:59 pm
Sáb Out 14, 2023 12:15 pm
Qua Out 11, 2023 6:07 pm
Seg Out 09, 2023 4:19 pm
Qua Out 04, 2023 12:12 pm
Qua Out 04, 2023 12:11 pm
Ter Out 03, 2023 9:18 pm
Ter Out 03, 2023 9:08 pm
Ter Out 03, 2023 6:05 pm
Ter Set 26, 2023 12:45 pm
Seg Set 25, 2023 9:02 pm
Seg Set 25, 2023 9:47 am
Sáb Set 23, 2023 2:10 pm
Sex Set 22, 2023 9:01 pm
Qui Set 21, 2023 11:04 am
Qua Set 20, 2023 4:40 pm
Qua Set 20, 2023 9:15 am
Dom Set 17, 2023 12:17 pm
Sex Set 15, 2023 7:24 pm
Sex Set 15, 2023 5:41 pm
Sex Set 15, 2023 4:28 pm
Sex Set 15, 2023 10:56 am
Sex Set 15, 2023 10:15 am
Seg Set 11, 2023 11:43 am
Seg Set 11, 2023 11:31 am
Sáb Set 09, 2023 4:53 pm
Sáb Set 09, 2023 1:44 pm
Ter Set 05, 2023 11:12 pm
Ter Set 05, 2023 3:12 pm
Seg Set 04, 2023 11:53 pm



































































































Conversor de movimento do Unity para o MMD [Ajuda]

Ir para baixo

DÚVIDA Conversor de movimento do Unity para o MMD [Ajuda]

Mensagem por AGAMENOM Qua Abr 05, 2023 4:15 am

Bem eu estou fazendo um script que salva os movimentos para o MMD. Mas ele está com alguns erros.

Sendo estes erro na convenção da rotação e movimento dos osso.

No vídeo eu explico melhor.


Se caso alguém quiser dar uma olhada e tentar me ajudar estou deixado o arquivo para baixar.
Miku Miku Dance Collection.rar
AGAMENOM
AGAMENOM
Avançado
Avançado

Masculino PONTOS : 1536
REPUTAÇÃO : 15
Idade : 21
Respeito as regras : Conversor de movimento do Unity para o MMD [Ajuda] WvDYdlf

https://paradoxicaltimegam.wixsite.com/paradoxicaltime

Ir para o topo Ir para baixo

DÚVIDA Re: Conversor de movimento do Unity para o MMD [Ajuda]

Mensagem por AGAMENOM Dom Abr 09, 2023 12:06 am

Olá bem eu consegui fazer ele funcionar.
Então eu queria saber se da para fazer uma bool para evitar de salvar frames repetido.

exemplo de como ele esta salvado no estado atual:

Nome do Osso,0,-0.385,-0.631,0.213,0,0,0
Nome do Osso,1,-0.385,-0.631,0.213,0,0,0
Nome do Osso,2,-0.385,-0.631,0.213,0,0,0
Nome do Osso,3,-0.385,-0.631,0.213,0,0,0
Nome do Osso,4,-0.385,-0.631,0.213,0,0,0
Nome do Osso,5,-0.385,-0.631,0.213,0,0,0

Ai se a bool fosso ativa ele so salvava o primeiro e o último com os valores repetidos:

Nome do Osso,0,-0.385,-0.631,0.213,0,0,0
Nome do Osso,5,-0.385,-0.631,0.213,0,0,0

Assim evitaria de salvar frames necessários no arquivo.

Script que Salva o arquivo:
Código:
using System.Globalization;
using System.IO;
using UnityEngine;
using System.Text;

public class ModelRecorderSave : MonoBehaviour
{
    [Header("Model Recorder Save")]
    [SerializeField] private string FileSave = "Miku Miku Dance Collection/Save Movements/Movement/TestMovement.csv"; // CSV file name.
    [SerializeField] private string ModelName = "TestModel"; // model name.
    [SerializeField] private int KeyFrameSaves; // number of keyframes saved.
    [Space(5)]
    [Header("Settings.")]
    [SerializeField] private Animator animator; // model animator.
    [SerializeField] private int savingsReduction = 3; // keyframe reduction.
    [SerializeField] private bool SkipFirstFrame = false; // whether to skip the first frame or not.
    [Space(5)]
    [Header("MMD Frame Counter")]
    [SerializeField] private int MMDFrameCount = 0; // MMD frame counter.
    [Space(5)]
    [Header("All ModelRecorder Scripts.")]
    [SerializeField] private ModelRecorder[] recorders; // array of all ModelRecorder scripts in the model.
    [Space(5)]
    [SerializeField] private VMDRecorderSampleInformation Information; // VMDRecorder information.

    private static readonly float MMDFrameTime = 0.033333f; // time between each MMD frame.
    private float elapsedTimeCharacter = 0f; // elapsed time of the character.

    private float animationLength; // total duration of the animation.
    private bool EndAnimation = false; // if the animation has come to an end.

    private static readonly string Format = "Vocaloid Motion Data 0002"; // CSV file format.
    private static readonly int codeType = 0; // code type in CSV file.

    private void Awake()
    {
        animationLength = animator.GetCurrentAnimatorStateInfo(0).length;  // gets the total duration of the animation.

        recorders = FindObjectsOfType<ModelRecorder>(); // Get all ModelRecorder scripts in sena.

        // configures each ModelRecorder script.
        foreach (ModelRecorder recorder in recorders)
        {
            recorder.animator = animator;
            recorder.SavingsReduction = savingsReduction;

            if(SkipFirstFrame == true)
            {
                recorder.SkipFirstFrame = true;
            }
            else
            {
                recorder.SkipFirstFrame = false;
            }
        }
    }

    void Update()
    {
        animationLength -= Time.deltaTime;

        // when the animation comes to an end, it saves the CSV file.
        if (animationLength <= 0 && !EndAnimation)
        {
            EndAnimation = true;
            Save();
        }

        // if the animation has not yet reached the end, it updates the MMD frame counter.
        if (EndAnimation == false)
        {
            elapsedTimeCharacter += Time.deltaTime;

            if (elapsedTimeCharacter >= MMDFrameTime)
            {
                MMDFrameCount++;
                elapsedTimeCharacter -= MMDFrameTime;
            }
        }
    }

    void Save()
    {
        // gets the total number of keyframes saved.
        int totalSaves = 0;
        foreach (ModelRecorder recorder in recorders)
        {
            totalSaves += recorder.animationRecorder.Count;
        }

        KeyFrameSaves = totalSaves;

        string filePath = Application.dataPath + "/" + FileSave; // full path of CSV file.
        var encoding = Encoding.GetEncoding("shift_jis"); // Set file encoding to Shift_JIS.

        // creates a CSV file and writes the information to it.
        using (StreamWriter writer = new StreamWriter(filePath, false, encoding))
        {
            writer.WriteLine(Format + "," + codeType); // writes the first line with the format and code type.
            writer.WriteLine(ModelName); // write the name of the model.
            writer.WriteLine(KeyFrameSaves); // writes the number of keyframes saved.

            // for each ModelRecorder script, it writes the information of the saved animations.
            foreach (ModelRecorder recorder in recorders)
            {
                string boneName = recorder.BoneName;

                foreach (AnimationRecorder animRecorder in recorder.animationRecorder)
                {
                    int frame = animRecorder.Frame;
                    float xMovement = animRecorder.XMovement;
                    float yMovement = animRecorder.YMovement;
                    float zMovement = animRecorder.ZMovement;
                    float xRotation = animRecorder.XRotation;
                    float yRotation = animRecorder.YRotation;
                    float zRotation = animRecorder.ZRotation;

                    // Replacing commas with periods in variables.
                    string xMovementStr = xMovement.ToString(CultureInfo.InvariantCulture);
                    string yMovementStr = yMovement.ToString(CultureInfo.InvariantCulture);
                    string zMovementStr = zMovement.ToString(CultureInfo.InvariantCulture);
                    string xRotationStr = xRotation.ToString(CultureInfo.InvariantCulture);
                    string yRotationStr = yRotation.ToString(CultureInfo.InvariantCulture);
                    string zRotationStr = zRotation.ToString(CultureInfo.InvariantCulture);

                    // Writes the line with the current Key Frame information.
                    writer.WriteLine(boneName + "," + (frame - 1) + "," + xMovementStr + "," + yMovementStr + "," + zMovementStr + "," + xRotationStr + "," + yRotationStr + "," + zRotationStr);
                }
            }

            // Write the additional information at the end of the file.
            writer.WriteLine(codeType);
            writer.WriteLine(codeType);
            writer.WriteLine(codeType);
        }
        Debug.Log("Completion of CSV file creation"); // Displays a message on the console confirming the creation of the CSV file.

        Information.CharacterIsOver = true; // Sets the CharacterIsOver variable to true, indicating that character animation is complete.
    }
}

O Script que grava a animação se acharem necessário para compreender o código.
Código:
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class ModelRecorder : MonoBehaviour
{
    [Header("Settings.")]
    public Animator animator; // Animator component to record.
    [SerializeField] private Transform boneTransform; // variable to store the Transform of the bone that will be recorded.
    public ExtraArmRotation extraArmRotation; // ExtraArmRotation Script.
    public string BoneName; // Name of the bone to record.
    public bool RecorderRotation; // Whether to record rotation.
    public bool RecorderMovement; // Whether to record movement.
    public bool ZeroNegativeY; // Controls whether the Y-axis movement should be constrained to zero if the object is moving downwards.
    [Space(10)]
    [Header("MMD Frame Counter")]
    public int MMDFrameCount = 0; // Counter for MikuMikuDance frame count.
    public int SavingsReduction = 3; // Reduction rate for number of frames to save.
    public bool SkipFirstFrame; // Controls whether the first frame will be skipped or not.
    [Space(10)]
    public List<AnimationRecorder> animationRecorder = new List<AnimationRecorder>(); // List of recorded animations.
    [Space(10)]
    public Vector3 initialPosition; // Initial position of the character.

    private static float mmdFrameTime = 0.033333f; // Time for each MMD frame.
    private float elapsedTimeCharacter = 0f; // Elapsed time for the character since last MMD frame.
    private bool FirstFrame = true; // Tracks whether this is the first frame or not.
    private float animationLength; // The length of the current animation.
    private bool EndAnimation = false; // Whether the animation has ended.

    // Adds the LateUpdate() method to the call queue of EditorApplication.delayCall() in Awake().
    private void Awake()
    {
        EditorApplication.delayCall += LateUpdate;
    }

    private void Start()
    {
        animationLength = animator.GetCurrentAnimatorStateInfo(0).length; // Get the length of the current animation.
    }

    // Removes the LateUpdate() method from the call queue of EditorApplication.delayCall() in OnDisable().
    private void OnDisable()
    {
        EditorApplication.delayCall -= LateUpdate;
    }

    void Update()
    {
        animationLength -= Time.deltaTime;  // Decrease the length of the animation by the time passed since the last frame.

        // If the animation has ended and EndAnimation is false.
        if (animationLength <= 0 && !EndAnimation)
        {
            // Ensures last MMD frame is saved if SavingsReduction is greater than 0.
            if (EndAnimation == false && SavingsReduction > 0)
            {
                Recorder(); // Record animation data.
            }

            EndAnimation = true; // Set EndAnimation to true.
        }
    }

    private void LateUpdate()
    {
        // Checks if this is the first time LateUpdate has been called.
        if (FirstFrame && SkipFirstFrame)
        {
            // If so, set FirstFrame to false and return immediately, skipping the first frame.
            FirstFrame = false;
            return;
        }

        // If the animation has not ended.
        if (EndAnimation == false)
        {
            elapsedTimeCharacter += Time.deltaTime; // Add the time passed since the last frame to elapsedTimeCharacter.

            // If the elapsed time for the character since the last MMD frame is greater than or equal to the time for each MMD frame.
            if (elapsedTimeCharacter >= mmdFrameTime)
            {
                MMDFrameCount++; // Increment the MMD frame count.

                // If SavingsReduction is 0 or the MMD frame count is divisible by SavingsReduction.
                if (SavingsReduction == 0 || MMDFrameCount % SavingsReduction == 0)
                {
                    Recorder(); // Record animation data.
                }

                // Ensures first MMD frame is saved if SavingsReduction is greater than 0.
                if (SavingsReduction > 0 && MMDFrameCount == 1)
                {
                    Recorder(); // Record animation data.
                }

                elapsedTimeCharacter -= mmdFrameTime; // Subtract the time for each MMD frame from elapsedTimeCharacter.
            }
        }
    }

    // Records the animation data.
    void Recorder()
    {
        AnimationRecorder animRec = new AnimationRecorder(); // Create new animation recording object.

        // If motion recording is enabled, records the object's position relative to its starting position.
        if (RecorderMovement == true)
        {
            Vector3 currentPosition = transform.position;
            Vector3 recordedPosition = currentPosition - initialPosition; // Calculate the movement since the initial position.
            float scale = 0.08f;
            animRec.XMovement = Mathf.Round(-recordedPosition.x / scale * 1000f) / 1000f; // Round and save X-axis movement.
            animRec.ZMovement = Mathf.Round(-recordedPosition.z / scale * 1000f) / 1000f; // Round and save Z-axis movement.

            // Checks whether or not to readjust the Y movement value.
            if (ZeroNegativeY == true)
            {
                // Checks if the Y coordinate value is less than zero.
                if (recordedPosition.y <0)
                {
                    recordedPosition.y = 0; // If yes, sets the Y coordinate value to zero.
                }

                animRec.YMovement = Mathf.Round(recordedPosition.y / scale * 1000f) / 1000f; // Round and save Y-axis movement.
            }
            else
            {
                animRec.YMovement = Mathf.Round(recordedPosition.y / scale * 1000f) / 1000f; // Round and save Y-axis movement.
            }
        }

        // If rotation recording is enabled, records the object's rotation relative to its initial rotation.
        if (RecorderRotation == true)
        {
            Transform boneTransform = this.boneTransform;
            Vector3 currentRotation = boneTransform.localEulerAngles;
            Vector3 recordedRotation = currentRotation;

            // Check if extraArmRotation is empty.
            if (extraArmRotation != null)
            {
                // If extraArmRotation is attached to it adds the extra rotations to the animation.
                Vector3 extraRotation = new Vector3(recordedRotation.x + extraArmRotation.rotacaoX, recordedRotation.y + extraArmRotation.rotacaoY, recordedRotation.z + extraArmRotation.rotacaoZ);

                // Normalizes the rotation angles to fall within the range of -180 to 180 degrees.
                float xRotation = NormalizeAngle(extraRotation.x);
                float yRotation = NormalizeAngle(extraRotation.y);
                float zRotation = NormalizeAngle(extraRotation.z);

                // Checks that the normalized angles are in the correct range and adjusts them if necessary.
                if (xRotation > 180)
                {
                    xRotation = xRotation - 360;
                }

                if (yRotation > 180)
                {
                    yRotation = yRotation - 360;
                }

                if (zRotation > 180)
                {
                    zRotation = zRotation - 360;
                }

                // Rounds and saves rotations on the X, Y, and Z axes.
                animRec.XRotation = Mathf.Round(-xRotation * 1000f) / 1000f;
                animRec.YRotation = Mathf.Round(yRotation * 1000f) / 1000f;
                animRec.ZRotation = Mathf.Round(-zRotation * 1000f) / 1000f;
            }
            else
            {
                // Normalizes the rotation angles to fall within the range of -180 to 180 degrees.
                float xRotation = NormalizeAngle(recordedRotation.x);
                float yRotation = NormalizeAngle(recordedRotation.y);
                float zRotation = NormalizeAngle(recordedRotation.z);

                // Checks that the normalized angles are in the correct range and adjusts them if necessary.
                if (xRotation > 180)
                {
                    xRotation = xRotation - 360;
                }

                if (yRotation > 180)
                {
                    yRotation = yRotation - 360;
                }

                if (zRotation > 180)
                {
                    zRotation = zRotation - 360;
                }

                // Rounds and saves rotations on the X, Y, and Z axes.
                animRec.XRotation = Mathf.Round(-xRotation * 1000f) / 1000f;
                animRec.YRotation = Mathf.Round(yRotation * 1000f) / 1000f;
                animRec.ZRotation = Mathf.Round(-zRotation * 1000f) / 1000f;
            }
        }

        animRec.Frame = MMDFrameCount; // Saves the current animation frame number to the footage object.

        animationRecorder.Add(animRec); // Add the current animation recording to the list of animation recorders.
    }
   
    private float NormalizeAngle(float angle)
    {
        // If the angle is greater than 180, subtract 360 to get its equivalent negative angle.
        if (angle > 180f)
        {
            angle -= 360f;
        }

        return angle; // Returns the normalized angle.
    }
}

// A class to store the animation recording data.
[System.Serializable]
public class AnimationRecorder
{
    [Header("Animation Recorder.")]
    public int Frame; // The frame number of the recorded animation.
    [Space(10)]
    public float XRotation; // The X-axis rotation of the recorded frame.
    public float YRotation; // The Y-axis rotation of the recorded frame.
    public float ZRotation; // The Z-axis rotation of the recorded frame.
    [Space(10)]
    public float XMovement; // The X-axis movement of the recorded frame.
    public float YMovement; // The Y-axis movement of the recorded frame.
    public float ZMovement; // The Z-axis movement of the recorded frame.
}
AGAMENOM
AGAMENOM
Avançado
Avançado

Masculino PONTOS : 1536
REPUTAÇÃO : 15
Idade : 21
Respeito as regras : Conversor de movimento do Unity para o MMD [Ajuda] WvDYdlf

https://paradoxicaltimegam.wixsite.com/paradoxicaltime

Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos