aws-samples / amazon-sumerian-hosts

Amazon Sumerian Hosts (Hosts) is an experimental open source project that aims to make it easy to create interactive animated 3D characters for Babylon.js, three.js, and other web 3D frameworks. It leverages AWS services including Amazon Polly (text-to-speech) and Amazon Lex (chatbot).
MIT No Attribution
183 stars 82 forks source link

Clips - When/where are the objects populated? #141

Closed AdonousTech closed 2 years ago

AdonousTech commented 2 years ago

I am attempting to understand this code better. I really appreciate the effort to make an example project, but its convoluted and the code is too terse for an reference/example project. Someone really likes destructuring assignments. I think it would have been better to sacrifice the latest and greatest language features and focus more on readability.

I am currently stuck on the block below. I see these objects instantiated, but I don't see where the values of each array are populated. Look at the first item below, for example, "idleClips1". If I inspect the object after instantiating here, it contains the stand_idle_clip, which is great, BUT, how and where was it populated? Any insight will be appreciated.

        const [
          idleClips1,
          lipsyncClips1,
          gestureClips1,
          emoteClips1,
          faceClips1,
          blinkClips1,
          poiClips1,
        ] = clips1;

https://github.com/aws-samples/amazon-sumerian-hosts/blob/46f44174b264e0bc134c7ad9f548eee99586dcfc/packages/amazon-sumerian-hosts-three/examples/three.html#L299

AdonousTech commented 2 years ago

I figured it out, so I'll go ahead and close this issue. Thanks!

Krxtopher commented 1 year ago

@AdonousTech I agree with you that our Three.js sample application is too complex and too difficult to understand. That said, we recently made some major ease-of-use improvements to the core Sumerian Host API and to many of the sample applications. This includes reducing the amount of required boilerplate code down from ~360 lines of code to just 7 lines of code and providing new sample applications that are narrowly focused on demonstrating individual features in a clear, easily digestible way. Unfortunately, we only updated the Babylon.js sample applications with these quality-of-life improvements. We haven't gotten around to doing the same for Three.js.

Until we have an opportunity to apply the same simplification to the Three.js sample application(s), you may find it helpful to use the Babylon.js samples as a reference. The way you implement code to interact with the Hosts and the new Amazon Lex functionality we've added should be identical (or very similar) between Three.js and Babylon.js even if some of the other 3D framework interaction code is not.