In our previous blog, we explored how to make a human follow a predefined path using JavaScript. If you missed it, be sure to check out the previous blog before continuing!
Now, let’s take things a step further and dive into how to create and automate Human Postures in 3DEXCITE using JavaScript. By the end of this tutorial, you’ll learn how to make your human actor perform dynamic postures triggered by specific actions.
Step 1: Import Human Model
The first step is to import a human model into your scene. Here’s how you do it:
Go to the Project Tree under Actors.
Right-click and select Create Humans to add a human model to your scene.
You can now position and adjust the human as needed.
Figure 1 : Creation of Human – Creative Eperience
Step 2: Create Human Posture
Next, we define a human posture that the character will assume at a certain point. This step is crucial for adding variety and realism to the character’s actions.
In the Properties panel, select the human model.
Locate the Posture Behavior section and choose a predefined posture or create a custom one for your human actor.
Adjust the pose settings as necessary to fit your scene. You can manipulate the body parts, facial expressions, and more.
Step 3: Create Animation Editor
Now, let’s set up the Animation Editor to handle the human movements and postures:
In the Animation Editor, create a new animation sequence.
Define keyframes to transition between different postures.
You can control the timing, speed, and smoothness of the transitions, giving the illusion of dynamic, lifelike movements.
Step 4: Create Scripted Actor
To automate the posture change, we need to use JavaScript:
Go to the Scene Graph and create a Scripted Actor.
Attach a new script to the scripted actor—this is where we will write the JavaScript code to trigger the human posture.
Here is the basic JavaScript code you can use to trigger the posture change:
var PostureEventClass = function () { EP.Event.apply(this, arguments); };
if (!STU.PostureEvent) { STU.PostureEvent = PostureEventClass; }
if (!EP.EventServices.getEventByType(PostureEventClass.prototype.type)) { EP.EventServices.registerEvent(PostureEventClass); }
beScript.onStart = function () { // Initialization when the script starts };
beScript.onStop = function () { // Cleanup when the experience stops };
beScript.execute = function (context) { // Called every frame };
beScript.onAllKeyboardRelease = function (iEvent) { if (iEvent.key === this.TriggerKey) { // Use your custom key value let newEvent = new STU.PostureEvent(); this.actor.dispatchEvent(newEvent); } };
In this code:
We define a PostureEventType to trigger the posture change.
We listen for keyboard input to trigger the event (e.g., pressing ‘L’ for posture).
Once the key is pressed, a PostureEvent is dispatched to the human actor to execute the desired posture.
Step 5: Create Scene Scenario
With the Scripted Actor in place, let’s link everything together using Storytelling:
Open Storytelling and Create a New Scenario.
Add an “Each Time Script Actor is Executed” action.
Specify that the Animation should perform a posture change when the script is executed.
Step 6: Play the EXPERIENCE
Finally, hit the Play button to run the experience:
Once you start the experience, press ‘L’ (or the key you defined in the script).
The human actor will automatically transition into the posture you set up in the animation.
Conclusion
With these steps, you’ve successfully created and automated Human Postures in 3DEXCITE using JavaScript. The next time you create a scene, you can apply these techniques to bring more realism and interactivity to your 3D experience. Whether it’s for a demonstration or an immersive storytelling moment, Human Postures add a dynamic touch that enhances the user experience.
Hanen Bdioui, founder of ChampionXperience, is a Sales Development Representative skilled in SimLab Soft, SOLIDWORKS, 3DEXPERIENCE, and 3DEXCITE. She helps companies and learners explore VR, AR, and PLM solutions to drive innovation.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
[…] the next tutorial, we’ll take things further by automating postures and gestures using JavaScript. Stay tuned—it’s going to be […]