G
G
godsplane2021-07-07 14:27:55
three.js
godsplane, 2021-07-07 14:27:55

Initial position of glb model?

Hello. Began to delve into this technology and can not understand one point. Here is my model.
Does it initially have some kind of initial position? How can I set any model exactly? That is, I have a phone model, With this code, it is in this position

spoiler
const renderer = new THREE.WebGLRenderer();
const scene = new THREE.Scene();
const camera =new THREE.PerspectiveCamera(
    75,
  window.innerWidth / window.innerHeight,
  1,
  1000
);
camera.position.z = 1;

let mesh;

renderer.setSize(window.innerWidth, window.innerHeight);
scene.background = new THREE.Color(0xeff5555);
scene.add(new THREE.HemisphereLight(0xffffcc, 0x333399, 1.0));
camera.position.z = 3; 
camera.position.y = 15; 

new GLTFLoader().load('/images/content/iphone.glb', ({ scene: model }, animations) => {
  scene.add(model);
  
  model.scale.setScalar(1);
  
  camera.lookAt(model.position);

  mesh = model;

  mesh.scale.set( 10, 10, 10 );



});

const animate = () => {
  if (mesh) {
    mesh.rotation.y = 0;
    mesh.rotation.x = 0;
    mesh.position.y = 0;
    mesh.position.x = 0;
  }

  renderer.render(scene, camera);

  requestAnimationFrame(animate);
};

animate();

document.body.appendChild(renderer.domElement);

60e58f831f0d9428567333.png

Do I need to tweak the camera.pos model.rotation values ​​each time to align the model to its normal position?
ps plus another "ladder" at the borders because of what could it be?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question