Exploring Three.js: Working with WebGL and Skinned Mesh Avatars

In an attempt to showcase a skinned mesh avatar on Safari using WebGL (three.js r71), I have encountered some issues. Below is the code snippet for reference, with camera, lighting, scene, and renderer already set up:

loader = new THREE.JSONLoader();  
            loader.load( 'models/avatar.json', addModel );

            guiControls = new function() {

                // Various control options for different body parts
                
            }

            datGUI = new dat.GUI();

            // Adding controls for scene, rotation, and scale

            var helpset;

            function addModel( geometry,  materials ){

                    // Setting up material skinning
                    materials[0].skinning = true;
                    objeto= new THREE.SkinnedMesh( geometry, new THREE.MeshFaceMaterial(materials));
                    scene.add(objeto);

                    helpset = new THREE.SkeletonHelper(objeto);
            } 

        }

        // Custom render function
        function render() {
            
            // Updating bone rotations based on GUI controls
            
        }

        function animate(){

            render();
            renderer.render(scene, camera);
            requestAnimationFrame(animate);

        }

        init();
        animate(); 

Upon removing the line "materials[0].skinning = true;", the avatar successfully displays in the browser, but the bones remain static. Should I enable skinning to achieve bone rotation functionality?

Answer №1

After some investigation, I have discovered the solution. It turns out that enabling skinning is necessary in order to rotate the bones effectively.

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

Dropdown list remains open despite a selection being made

My problem arises when I attempt to select an item from the list, as the dropdown menu does not populate automatically and the list remains open. Here is the HTML code for the dropdown list: <label id='choose' for='options'>Sele ...

Explore various THREE.JS 3D models through a clickable link

I am struggling to make each object open a new page using a URL when clicked. No matter what I try, it doesn't seem to work properly. Can someone point out what I might be missing or doing wrong? Here is the click event code for the objects. If needed ...

What are the best practices for managing mouse events in AlpineJS when working with my menu?

I'm currently tackling the challenge of developing a mega dropdown menu feature using alpine.js and Tailwind CSS. Unfortunately, I've hit a roadblock as I can't seem to get the mouse events functioning correctly. In the snippet below, you&ap ...

Issue with transmitting Razor form data to API controller using fetch or AJAX

I have created a basic razor web project and defined it as follows: in program.cs I added builder.Services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN"); In the controller, this is what I did: [Route("/api/[controller]")] [ApiCon ...

not capable of outputting findings in a sequential manner

I am encountering an issue where my result is not printing line by line, instead everything shows up on a single line. How can I resolve this problem? Here is the code snippet I have tried: <script> function know(){ var num = Number(doc ...

Obtain translations from HTML and JavaScript files

Currently, I am working on a project using Angular 1.6 and incorporating angular-translate for internationalization. The setup for Angular-translate is complete and functioning properly. When I manually include text like: {{'Test' | translate}} ...

Incorporating react-intl-tel-input into your project: A step

Greetings, I am currently delving into the realm of ReactJS and am tasked with incorporating react-intl-tel-input to capture phone numbers from around the globe. However, during the integration process, I encountered some obstacles. When I input this code: ...

The state is not being processed properly

One challenge I am facing involves two components where a user can attach an image or gif to a post. When the image is clicked, a modal pops up and I aim to pass the data back to the modal so that the clicked image displays. To address this issue, I imple ...

Invoke an Ajax function to trigger another Ajax function once complete

var App = { actionRequest: function (url,data,callback){ var that = this; $('#menu').panel('close'); $.mobile.loading('show'); $.when( $.ajax({ method: 'POST', url: ur ...

The script tag in NextJS is not properly loading the Amplitude library

I am facing an issue with loading events using Amplitude JS for tracking, despite having the correct code in place. Here is the code snippet that I used: import Document, { Html, Head, Main, NextScript } from 'next/document'; import Script from & ...

Tips for concealing text in ion-option ionic2

Is there a way to hide text within an ion-option? I'm looking to conceal or remove certain text from displaying in an ion-option without deleting the underlying data. This is important as I want users to be able to choose it. <ion-select [(ngModel ...

What causes a ReferenceError when attempting to retrieve the class name of a React component?

Take a look at my React component located in index.js: import React from 'react' import ReactDOM from 'react-dom' class App extends React.Component { render() { return ( <div className="App"> <h1>Hello, ...

Error encountered: Class not found exception in the context of JSONArray

import org.json.JSONArray; JSONArray json=new JSONArray(al); response.setContentType("application/json"); response.getWriter().print(json); } Despite having included the necessary jar in my project, I am encountering this error: SEVERE: Servle ...

Inquiry about the notification: "Three.WebGLRenderer: Image size has been adjusted from (4160x3120) to (4096x3072)."

While loading a large image, I am noticing a warning on the console: "THREE.WebGLRenderer: Texture has been resized from (4160x3120) to (4096x3072)." This warning originates from three.module.js, triggered when surpassing the maxSize of 4096 c ...

Tips for refreshing a specific div element at set intervals using JQuery AJAX?

I need to make updates to a specific div element without refreshing the entire HTML page. The code below currently works, but it reloads the entire HTML page. Additionally, I am working with different layouts where I have separate files for the header, l ...

Develop a TypeScript class by incorporating a static function from an external library, while ensuring type safety

I am looking to enhance the capabilities of the rxjs5 Observable class by adding a static function. While this can be easily accomplished in plain JavaScript: var myStaticFn = function() { /* ... */ }; Observable.myStaticFn = myStaticFn; this approach w ...

Guide to dynamically load external JavaScript script in Angular 2 during runtime

Currently, I am integrating Twitter digits for authentication purposes. To implement this feature, a small .js script needs to be downloaded and initialized. The recommended approach is to directly fetch the file from the Twitter server. In order to succe ...

UPDATE: An issue has been identified with the /login route that is currently causing an unknown error

Hours of coding and suddenly my app is rendering everything twice. Can't figure out why, please help! https://i.sstatic.net/RhMid.png app.js import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; import "bootstrap/ ...

Async Laziness Loading

At the moment, our team is utilizing the SAP HANA Database for data storage. We plan to retrieve this data using a Node.JS-API through AJAX calls in order to take advantage of asynchronous processing. However, we have encountered a challenge: Across multi ...

The repository's dependencies remain unresolved by Nest

I encountered an error in my nestjs application. Unfortunately, I am having trouble identifying the issue within my code snippet. Here is a glimpse of the relevant sections: AppModule import { Module } from '@nestjs/common'; import { TypeOrmMod ...