Why doesn't ThreeJS Animation geometry update while the position does change?

As a newcomer to Blender, 3DS MAX, ThreeJS, and graphics programming in general, I encountered an issue with animating a Mutalisk from StarCraft. I imported the animation as an .m3 file into Blender, then exported it as a .json for use in my ES6 application. However, although the position of the Mutalisk changes correctly, the flapping animation does not occur as expected.

Below is the code snippet for my renderer:

import THREE from 'three';

export default class Renderer {
  constructor(game, canvas) {
    this.game = game;
    this.canvas = canvas;

    this.scene = new THREE.Scene();

    this.camera = new THREE.PerspectiveCamera(75, this.canvas.width / this.canvas.height, 1, 10000);
    this.camera.position.z = 2;
    this.camera.position.y = 1;

    this.clock = new THREE.Clock;

    this.renderer = new THREE.WebGLRenderer({ canvas: this.canvas });
    this.renderer.setSize( this.canvas.width, this.canvas.height );
  }

  // called by my Game class, which waits for the mesh to load before attempting to add it to the scene
  addMeshToScene(mesh) {
    this.mesh = mesh;

    this.scene.add(this.mesh);

    this.animation = new THREE.Animation(
      this.mesh,
      this.mesh.geometry.animations[ 2 ]
    );

    this.animation.play();
  }

  renderFrame() {
    THREE.AnimationHandler.update(this.clock.getDelta());

    this.renderer.render(this.scene, this.camera);
  }
}

In the rendered output, the Mutalisk appears to bounce along the Y-axis but lacks the expected flapping motion. Any insight on why the movement occurs without the flapping animation would be greatly appreciated.

Edit: Here are the export settings used in Blender.

https://i.sstatic.net/j3EnN.png

Answer №1

Resolved. The solution was to ensure that materials are set to skinning mode in order to correctly wrap the skeleton. In my case, when I generated my mesh from JSON, I needed to include the line material.skinning = true

import THREE from 'three';

export default class CustomMesh {
  constructor(name) {
    this.name = name;
    this.ready = false;
    this.filePath = `./models/${this.name}.json`
    this.load();
  }

  load() {
    var loader = new THREE.JSONLoader();
    loader.load(this.filePath, (geometry) => {
      this.geometry = geometry;
      var material = new THREE.MeshBasicMaterial( { color: 0x00ffff, wireframe: true } );
      material.skinning = true; // crucial step
      this.mesh = new THREE.SkinnedMesh(geometry, material);
      this.ready = true;
    });
  }
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips on incorporating and defining a fresh default (active) product tab on the WooCommerce product page

I am currently using the WooCommerce plugin on my WordPress website and I am attempting to modify the default tab on the single-product.php page. Take a look at my website here Currently, the second tab is active but I want to make the first tab the defa ...

Which function is most suitable for verifying if the values from req.param are NaN and assigning a new value if they are found to be NaN?

Regarding the about page: I'm currently working on a react app that sends URL parameters to the backend server. The frontend URL looks something like this: maxprice=100000&minsqm=50&maxsqm=100&page=1, which are the user's filters for ...

Issue creating a JWT using jsonwebtoken module in Node.js

Could someone help me troubleshoot an issue I'm having while trying to generate a JWT token? The error message "TypeError: Right-hand side of 'instanceof' is not an object" keeps appearing even though the syntax seems correct. const jsonwebt ...

Strange Node.js Issue

I don't have much experience with node.js, but I had to use it for launching on Heroku. Everything was going smoothly until a few days ago when suddenly these errors started appearing. Error: /app/index.jade:9 7| meta(name='viewport', co ...

Adjust the text within the treeview node for proper alignment

My treeview has nodes that display text, but when the length of the text increases, it moves to the next line and starts one place before the upper text, causing alignment issues. Is there a way to use CSS or JavaScript to properly align the text? Regards ...

Issues arise when node error handlers encounter bugs while utilizing the error pattern (err, req, res, next)

Currently, my node application is running with the express middleware for handling requests using the GET method. I have implemented error handling for 404s or 500s at the end of my script, after the GET method. However, I have encountered an issue with us ...

Retrieve a collection of JavaScript primitive data types in a systematic manner

Is there a way in JavaScript to programmatically access a list of primitive types or determine if a string is a type? This question focuses on language features rather than specific algorithms. Instead of manually creating an array like ['string&apos ...

Using three.js in Rails the right way

I've looked everywhere for a solution to this problem, but unfortunately haven't found anything helpful. Currently, I'm in the process of creating a new Ruby on Rails application and I want to start practicing using three.js. To check if it ...

When assessing a list against an array of objects in JavaScript

I am currently working on some Angular code with the objective of minimizing the use of Angular 1.x functionality, as it will be refactored in the near future. My task involves comparing an array: let subscription = [ "Cinemax Subscription", "Disn ...

Unable to upload any further verification documents to Stripe Connect bank account in order to activate payouts

Query - Which specific parameters should I use to generate the correct token for updating my Stripe bank account in order to activate payouts? I've attempted to activate payouts for my Stripe bank account by using a test routing and account number (t ...

How can I effectively display personalized information from an MSAccess database on a WordPress website?

I am seeking advice from experienced Wordpress developers. My organization possesses an internal MS Access database that comprises various tables, reports, and input forms. The structure of the database is relatively straightforward, encompassing informati ...

Convert the property that starts with XX from XML to JSON

I am currently working on a function that looks like this request.execute('[someSP].[spSomeSP]', function(err, dataset) { _.map(dataset, function(items) { console.log(items); }); }); When the _.map(...) is executed, it retu ...

Vue.js 2: Keep an eye on changes, but wait until after the initial data fetch

I recently entered the Vueverse (using Vue.js 2) and I'm encountering some challenges with the watch feature. When the component is mounted, I fetch data from an API and use it to set the value of a radio button. Essentially, I have two radio buttons ...

Customizing text inputs in three.js

Why are the HTML textboxes disabled for input when the "render" button is working properly? I have tried changing the render.domElement to different elements on the page such as container, info, parent, and scene, but I cannot figure out the reason for t ...

Exporting a variable that is currently in use within a function being exported

I am currently working on setting up my mongodb in a separate file. I have created an initialization function where I write all the necessary code for connecting to the database and exporting the function. However, I also need to export the 'db' ...

Firebase Firestore replicates documents, subcollections, and data

Here is a sample structure: .doc Name .colection 1 .doc sub_doc .collection sub_col1 .doc sub_doc .collection 2 .doc sub_doc I want to duplicate this document, including all its sub-collections, to create an ex ...

An advanced template system incorporating dynamic scope compilation

My project requires a unique solution that cannot be achieved with standard data-binding methods. I have integrated a leaflet map that I need to bind with a vue view-model. While I was able to display geojson features linked to my view, I am facing chall ...

The content in Angular UI Grid fails to display until the browser window is adjusted

I am currently utilizing angularjs 1.5.0 along with angular ui grid 3.1.1. In my controller, I assign the gridOptions object (which is passed to the grid directive) in the following way: $scope.gridOptions = { data: [{"mock2": 1, "mock1": 2}, {"moc ...

VueJs: Finding the corresponding value of a data object

Is there a way to extract data from an object in Vue? This is the format of my data: datasets: [{ text:"Cars", value: "[1,2,3]" }, { text:"Trains", value: "[1,4,10] } ] When I receive information from route props like this: this.selectedText= this ...

The absence of onreadystatechange() on XMLHttpRequest objects is proving to be problematic

(function (updateSend) { XMLHttpRequest.prototype.send = function () { console.log(this.onreadystatechange); //null updateSend.apply(this, arguments); }; })(XMLHttpRequest.prototype.send); Why does this.onreadystatechange ev ...