[Bug] Failed to set position/rotation for children nodes in SceneGraphLayer
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 14.6k
- Forks
- 2.3k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 42
Description
Description
I'm trying to set position and rotation for boneNode of a boned gltf model loaded via sceneGraph, but failed for all the nodes except the root one.
Even for the root one, it takes a while for the rendered result to update
Flavors
- React
- Python/Jupyter notebook
- MapboxLayer
- GoogleMapsOverlay
- CartoLayer
- DeckLayer/DeckRenderer for ArcGIS
Expected Behavior
The shape of the model should change according to the position/rotation set to its nodes.
Yet I found I can only config sceneLayer.state.scenegraph which is a ScenegraphNode from luma.gl to adjust its position and rotation. Configuring its children which are GroupNode that extends ScenegraphNode, does not change the rendering result.
Steps to Reproduce
The methods setRootRotation and setNodePelvisRotation use same logic, the only difference is the nodes they work with. Yet, the one manipulate root ScenegraphNode works, the other manipulating child GroupNode does not.
const INITIAL_VIEW_STATE = {
latitude: 37.7749,
longitude: 122.4194,
zoom: 4.5,
maxZoom: 20,
maxPitch: 180,
bearing: -90,
pitch: 0,
maxPitch: 89,
minPitch: -89,
position: [122.4194, 37.7749]
},
data = [
{
"name": "Lafayette (LAFY)",
"code": "LF",
"address": "3601 Deer Hill Road, Lafayette CA 94549",
"entries": "3481",
"exits": "3616",
"coordinates": INITIAL_VIEW_STATE.position
}
],
modelLayer = new ScenegraphLayer({
id: 'model-layer',
data,
pickable: true,
scenegraph: '/public/models/xbot.glb',
getPosition: d => d.coordinates,
getOrientation: d => [0, Math.random() * 180, 90],
_animations: {
'*': {speed: 5}
},
sizeScale: 1,
_lighting: 'pbr'
}),
fpv = new FirstPersonView({
focalDistance: 100,
fovy: 80,
// near: 0.1,
far: 10000,
}),
layers =[modelLayer],
deck = new Deck({
canvas: 'deckCanvas',
initialViewState: INITIAL_VIEW_STATE,
controller: true,
layers,
views: [fpv]
})
window.modelLayer = modelLayer
window.deck = deck;
// This works
function setRootRotation () {
let rotation = [Math.random(), Math.random(), Math.random()],
node = modelLayer.state.scenegraph;
node.setRotation(rotation);
nodeupdateMatrix();
deck.redraw(true)
}
// This doesn't work on a child GroupNode
function setNodePelvisRotation () {
let rotation = [Math.random(), Math.random(), Math.random()],
node = modelLayer.state.scenegraph.children[0].children[2].children[0];
node.setRotation(rotation);
nodeupdateMatrix();
deck.redraw(true)
}
Environment
- Framework version:"^8.8.0-beta.2"
- Browser:Version 103.0.5060.53 (Official Build) (x86_64)
- OS:Mac OS Monterey 12.4 (21F79)
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SceneGraphLayer implementation and the luma.gl ScenegraphNode update path described in the reproduction. Run the supplied root and child rotation calls, comparing the behavior after nodeupdateMatrix and deck.redraw(true). Done means rotations applied to child GroupNode instances visibly update the rendered model as the root rotation does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100