Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to keep fixed scale and size of Airplane 3D model when zoom in or out Mapbox? #155

Closed
sovanyuthchap opened this issue Dec 29, 2020 · 10 comments
Assignees
Labels
❓ question Further information is requested
Milestone

Comments

@sovanyuthchap
Copy link

sovanyuthchap commented Dec 29, 2020

Hi jscastro76,
I added Airplane 3D model fly with animation on the map, How to keep fixed scale and size of Airplane 3D model when zoom in or out the map ( map.on('zoom',function() {}) )? Help me please.

@jscastro76
Copy link
Owner

Wow... that’s exactly the opposite of what Threebox does, it would require some research... First thoughts you need to get the scale transformation from Threebox camera and invert it only for that object, that would neutralize the transformation being done at tb.world level

@jscastro76 jscastro76 added the ❓ question Further information is requested label Dec 29, 2020
@sovanyuthchap
Copy link
Author

@jscastro76, thank you so much for replying. I'll research and do follow your guide. If I have some issues, I'll contact you later.

@jscastro76 jscastro76 self-assigned this Jan 15, 2021
@jscastro76 jscastro76 added this to the v.2.1.7. milestone Jan 15, 2021
@jscastro76
Copy link
Owner

@sovanyuthchap I think I have very good news for you. I have this feature almost done, I only have to create a property for the object that sets the fixed scale mode

@sovanyuthchap
Copy link
Author

sovanyuthchap commented Jan 17, 2021 via email

@jscastro76
Copy link
Owner

Dear Jesus, It's the great news, thank you so much for adding this feature to me. I’ll test it now. Best regard Sovanyuth Chap

I'm finishing the push to upload it, finishing documentation. I'll comment here when ready to test

@sovanyuthchap
Copy link
Author

@jscastro76, Thanks so much brother for your help.

@jscastro76
Copy link
Owner

@jscastro76, Thanks so much brother for your help.

If you share your animation code, I can add it to the demo example

jscastro76 added a commit that referenced this issue Jan 20, 2021
@jscastro76
Copy link
Owner

fixedscale2
It was by far harder than what I stimated initially, because it impacts deeply the way the objects are being positioned and animated, apart from the shadows, bounding box... Here it is finally...
You can find the new example on how to create objects with fixed scale here

Enjoy!

@sovanyuthchap
Copy link
Author

Wow, I just see, thank you so much brother that helping resolve my task. Sorry that I reply you late, because I busy work on another project. The project that use your framework, my company pause it, waiting util company customer tell continue. And I can't share code with you, because it's my company policy. When my boss give me continue, I'll see and merge your code to my project.

@jscastro76
Copy link
Owner

No problem @sovanyuthchap, I totally understand.
I hope this feature covers your needs, I added explicitly an airplane demo because of your request, the path is at the end not very relevant.

jscastro76 added a commit that referenced this issue Jan 20, 2021
Minor version by [@jscastro76](https://github.com/jscastro76), some enhancements and bugs.

#### ✨ Enhancements
- #155 How to keep fixed scale and size of Airplane 3D model when zoom in or out Mapbox?
- #167 Create a new event `ObjectChanged` every time the object has modified its position, rotation or scale.
  - Related to #163 request to get coordinates when the model follow path with line?
  - Modified example [05-logistics.html](https://github.com/jscastro76/threebox/blob/master/examples/05-logistics.html) to attach to the event `ObjectChanged`
  - Modified example [11-logistics.html](https://github.com/jscastro76/threebox/blob/master/examples/11-animation.html) to attach to the event `ObjectChanged`
 - Modified example [08-3dbuildings.html](https://github.com/jscastro76/threebox/blob/master/examples/08-3dbuildings.html) to adjust perspective and position to a more relevant zone (empire state building)
- #170 Refactor internal methods
- #179 Create a new example for fixed scale model
  - Added to [19-fixedZoom.html](https://github.com/jscastro76/threebox/blob/master/examples/19-fixedZoom.html) that shows shows how to have a fixed scale for an object at a concrete zoom level. In that way the object with preserve the same visual size when the zoom is lower than the fixed zoom value.
- #181 Move npm modules to devDependencies and remove not used

#### 🪲 Bug fixes
- #168 Bug on init params `bbox` and `tooltip`
- #175 Shadows are not updated if an object is moved through animations
- #180 Fixed scale objects not being rescaled if they are being animated

#### 📝 Documentation
- Updated [documentation](/docs/Threebox.md) (`ObjectChanged`, `setFixedZoom`, `setObjectScale`, `setScale`, `modelHeight`, `unitsPerMeter` and other events)
- Updated [README.md](/).
- Updated [Examples](/examples) documentation (`19-fixedzoom.html`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants