Giter Club home page Giter Club logo

Comments (15)

nzjony avatar nzjony commented on August 24, 2024 1

@HHammerite , thanks for your bug report.

How are you adding the object to the mapAnchors ?

Setting the geoPosition should work, see the render method in MapView, specifically the line:
this.m_mapAnchors.children.forEach((childObject: MapAnchor) => {

We position all of the children relative to the camera. This is how all objects are rendered, the camera is then located at 0,0,0 and all objects are rendered relative to it.

However we don't position the mapAnchors object, its position would be at 0,0,0 in world space, so for example, if you are using globe projection, then the mapAnchors object would be position in the center of the world, but the children are positioned correctly.

Does that help?

from harp.gl.

harrycollin avatar harrycollin commented on August 24, 2024 1

That has solved half of my problem! It is now correct. Thank you @nzjony! I just need to figure out the camera issue now.

from harp.gl.

nzjony avatar nzjony commented on August 24, 2024 1

@HHammerite , great to hear!

What camera issue are you dealing with, we have an orbiting camera example here if it helps: https://www.harp.gl/docs/master/examples/#getting-started_orbiting-view.html

from harp.gl.

harrycollin avatar harrycollin commented on August 24, 2024 1

@nzjony Thank you! What's the best way to keep updated on this?

from harp.gl.

harrycollin avatar harrycollin commented on August 24, 2024 1

Cool, thank you @nzjony

from harp.gl.

harrycollin avatar harrycollin commented on August 24, 2024

Here is another screenshot where I don't set the .geoPosition of the building after it's loaded.
harp-issue-2

from harp.gl.

harrycollin avatar harrycollin commented on August 24, 2024

Hi @nzjony,

Thank you for your reply! I am adding the object to mapAnchors like this
map.mapAnchors.add(scene); where map is the mapView instance and scene is the main gltf scene.

That's good that the mapAnchors object is positioned at 0, 0, 0. This simplifies a lot.

I am adding the box helper like this
const box = new THREE.BoxHelper(scene); map.scene.add( box );

Is there a reason the box would be positioned like this?

from harp.gl.

nzjony avatar nzjony commented on August 24, 2024

I am adding the box helper like this
const box = new THREE.BoxHelper(scene); map.scene.add( box );

I think I see the problem, because the MapAnchor is positioned relative to the camera, its position is updated each frame, you need to add an event listener to the map render call and update the box before it is rendered, something like:

map.addEventListener(MapViewEventNames.Render, () => {
    box.update();
 });

Does that help?

from harp.gl.

harrycollin avatar harrycollin commented on August 24, 2024

@nzjony I've been using this Orbit Camera . However I'm struggling to set it's orbit position to the MapAnchor. If I using the regular orbit camera from three it works without any issues, just that the orbit axis is wrong.

from harp.gl.

harrycollin avatar harrycollin commented on August 24, 2024

The reason I'm using this is because I need to set the camera's focus to specific parts of the building

from harp.gl.

nzjony avatar nzjony commented on August 24, 2024

@HHammerite, can you try updating the target each frame, i.e. under the box.update();, make a call to set the target on the orbit controls?

from harp.gl.

harrycollin avatar harrycollin commented on August 24, 2024

That works! Awesome @nzjony! Thanks for your help. I have to ask for future reference, is there a way to get around all this continuous assignment & updating to simply interact with a MapAnchor?

from harp.gl.

nzjony avatar nzjony commented on August 24, 2024

@HHammerite , I agree that it is a bit cumbersome, i will create a separate ticket to improve the interface, as you say, it should be possible to just assign objects to the MapAnchor and not have to worry about updating their positions.

from harp.gl.

nzjony avatar nzjony commented on August 24, 2024

I created an issue: #1371

from harp.gl.

nzjony avatar nzjony commented on August 24, 2024

@HHammerite, otherwise can I close this issue?

from harp.gl.

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.