-
Sonar Systems adminLikes 0
How do you want to manipulate it?
This reply has been verified.
-
robertLikes 0
I would like to change textures, opacity, rotation etc.
For example - cube.rotation.x+= 90;.
This works fine when “cube” is created in Three.js
var cube = new THREE.Mesh( geometry, material );
scene.add( cube );When I import cube from Blender, “cube.rotation.x+= 90” gives “cube is not defined”.
loader.load('jsonText.json',function ( object ){
scene.add( object );
cube.rotation.x = 90;
}
);Json file is below.
{
"metadata": {
"version": 4.5,
"type": "Object",
"generator": "Object3D.toJSON"
},
"geometries": [
{
"uuid": "F587CA59-4813-4AC0-A16A-EE68CE473554",
"type": "BufferGeometry",
"data": {
"attributes": {
"position": {
"itemSize": 3,
"type": "Float32Array",
"array": [-0.5,0.5,1,-0.5,1.5,1,-0.5,1.5,-1,-0.5,0.5,1,-0.5,1.5,-1,-0.5,0.5,-1,-0.5,0.5,-1,-0.5,1.5,-1,0.5,1.5,-1,-0.5,0.5,-1,0.5,1.5,-1,0.5,0.5,-1,0.5,0.5,1,0.5,1.5,1,-0.5,1.5,1,0.5,0.5,1,-0.5,1.5,1,-0.5,0.5,1,-0.5,0.5,-1,0.5,0.5,-1,0.5,0.5,1,-0.5,0.5,-1,0.5,0.5,1,-0.5,0.5,1,0.5,1.5,-1,-0.5,1.5,-1,-0.5,1.5,1,0.5,1.5,-1,-0.5,1.5,1,0.5,1.5,1],
"normalized": false
},
"normal": {
"itemSize": 3,
"type": "Float32Array",
"array": [-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0],
"normalized": false
}
},
"boundingSphere": {
"center": [0,1,0],
"radius": 1.224745
}
}
}],
"materials": [
{
"uuid": "FBE8471B-9A87-46EF-B188-935A705E815D",
"type": "MeshPhongMaterial",
"name": "None",
"color": 16777215,
"emissive": 0,
"specular": 1118481,
"shininess": 30,
"flatShading": true,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true
}],
"object": {
"uuid": "D14B9B4B-4487-449C-8876-6669DDDE8D68",
"type": "Scene",
"name": "Scene",
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"children": [
{
"uuid": "92CBA877-46B1-48E5-8082-E933258FDE2F",
"type": "Group",
"name": "microwave.obj",
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"children": [
{
"uuid": "6D0B45BA-FF78-4795-A4DF-F213D1E40EFE",
"type": "Mesh",
"name": "cube",
"layers": 1,
"matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
"geometry": "F587CA59-4813-4AC0-A16A-EE68CE473554",
"material": "FBE8471B-9A87-46EF-B188-935A705E815D"
}]
}],
"background": 11184810
}
}
-
Sonar Systems adminLikes 0
So it works?
This reply has been verified.
-
robertLikes 0
No it doesn’t work, it returns cube as undefined.
-
Sonar Systems adminLikes 0
Can you show me the error
Login to reply