Hello, I have been working through several example sources (here’s the best so far) trying to activate a GLTF embedded animation. I am using Resium+Cesium for the ReactJs components and a useRef to get a handle to the raw cesium viewer. I can loop through the scene primitives but I can’t seem to add an animation.
The GLTF is exported from Blender and passes all the online GLTF testers. I just can’t seem to find out how to activate it.
I’ve attached the GLB file.
import React, {useEffect, useRef} from "react";
import {Cartesian3, Color} from "cesium";
import {Viewer, Entity, ModelGraphics, Model} from "resium";
export default function App() {
const ref = useRef(null); // raw Cesium Viewer
let asset = "assets/junk-iss.glb"
// Wait to grab a handle to the viewer
useEffect(() => {
if (ref.current && ref.current.cesiumElement) {
let primitives = ref.current.cesiumElement.scene.primitives
let primitive = primitives.get(0)
if (primitive.length) {
// Here is where I would like to activate my animation
return primitive.activeAnimations.add({name: "CylinderAction"});
}
}
}, [ref]);
return (
<Viewer ref={ref}>
<Entity
name="Tokyo"
position={Cartesian3.fromDegrees(139.767052, 35.681167, 100)}
point={{pixelSize: 10, color: Color.WHITE}}
description="hoge"
>
<Model>
<ModelGraphics
uri={asset}
minimumPixelSize={128}
maximumScale={20000}
// this appears to have no affect
runAnimations={true}
/>
</Model>
</Entity>
</Viewer>
);
}
junk-iss.glb (32.4 KB)