Giter VIP home page Giter VIP logo

Comments (1)

jonathanneels avatar jonathanneels commented on May 27, 2024 1

Hi great people

I found a solution.
It is based on the following link: https://codepen.io/evces/pen/vYrwQXW
In essence I made a custom interactable Three.js scene, so I have complete control over my objects.

const THREE = window.MINDAR.IMAGE.THREE;
     window["mindarThree"] = new window.MINDAR.IMAGE.MindARThree({
   container: document.querySelector("#container"),
   imageTargetSrc: "static/assets/lady/targets.mind"
     });
     const {renderer, scene, camera} = window["mindarThree"] ;
     const anchor = window["mindarThree"] .addAnchor(0);
     const geometry = new THREE.BoxGeometry(1, 1,1);
     const material = new THREE.MeshBasicMaterial( {color: 0x00ffff, transparent: true, opacity: 0.5} );
       window["plane"] = new THREE.Mesh( geometry, material );
     anchor.group.add( window["plane"]);
      const start = async() => {
   await window["mindarThree"].start();initMarkCheck();
   renderer.setAnimationLoop(() => {
   window["planepos"] =  window["plane"].getWorldPosition(new THREE.Vector3());
       window["planescale"] =  window["plane"].getWorldScale(new THREE.Vector3());
   	
   	var quaternion = new THREE.Quaternion();//REF/ https://stackoverflow.com/questions/55192521/what-to-do-now-three-getworldrotation-has-gone
  window["planerot"] =  window["plane"].getWorldQuaternion( quaternion )

 
   let campos = camera.getWorldPosition(new THREE.Vector3());
   //console.log(`Camera: ${campos.x},${campos.y},${campos.z}`);
   //console.log(`Plane: ${window["planepos"].x},${window["planepos"].y},${window["planepos"].z}`);

   window["plane"].lookAt(new THREE.Vector3());
     renderer.render(scene, camera);
   });
     }

I hope someone will be able to use this information (was a looooong search).

I wish you all a great day.

Kind regards
JN

from mind-ar-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.