I’m having trouble with the setMatrix()
function in Babylon.js playground.
Here’s a simplified version of my code:
`// Attributes
attribute vec3 position;
uniform mat4 worldViewProj; // 월드-뷰-투영 행렬
uniform mat4 world; // 월드 행렬
// uniform mat4 view; // 뷰 행렬
// uniform mat4 projection; // 투영 행렬
void main(void) {
gl_Position = world*vec4(position, 1.0);
}`;
const effectWrapper = new BABYLON.EffectWrapper({
engine: engine,
name: "redShader",
useShaderStore: true,
vertexShader: "custom",
fragmentShader: "custom",
attributeNames: ["position"],
uniformNames: ["worldViewProj", "world"]
});
const position = new BABYLON.Vector3(0,0,0);
const rotation = BABYLON.Quaternion.RotationYawPitchRoll(0, Math.PI/4,0);
// console.log(rotation);
const scaling = new BABYLON.Vector3(1,1,2);
var worldMatrix = BABYLON.Matrix.Compose(scaling, rotation, position);
effectWrapper.effect.setMatrix("world", worldMatrix);
babylon.playground.j…2161612:sourcemap:2 TypeError: Cannot read properties of undefined (reading ‘world’)
at e.setMatrix (babylon.js?t=1742282…:sourcemap:1:264268)
at e.setMatrix (babylon.js?t=1742282…sourcemap:1:1436337)
at createScene (:77:26)
at window.initFunction (:152:16)
at async R._compileAndRunAsync (babylon.playground.j…sourcemap:2:3001359) ‘Retrying if possible. If this error persists please notify the team.’
This is a error I got
My playground
Any help would be greatly appreciated! Thanks!