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

Drag n drop glb file from a library #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

vincentfretin
Copy link
Member

Models library in json format referencing glb files that can be drag n dropped into the scene.

Prior work with old Google Blocks, see tweet and code, code that do the drag'n drop here (jQuery) and here.

I reproduced the drag'n drop in React/tailwindcss on my project a few months ago but didn't go further yet, I opened the PR as draft with my current code as is. You need to rewrite the tailwindcss with stylus or vanilla css and replace the library with your own models if you want to see anything.

Example of json library:

  const library = [
  {
    "title": "Seat 1",
    "thumb": "/models/furnitures/seat_1.jpg",
    "url": "/models/furnitures/seat_1.glb",
    "author": "Vincent"
  },
  {
    "title": "Seat 2",
    "thumb": "/models/furnitures/seat_2.jpg",
    "url": '/models/furnitures/seat_2.glb",
    "author": "Vincent"
  }]

Capture d’écran du 2023-05-19 10-09-10

@vincentfretin
Copy link
Member Author

@kfarr is this implementation if you click instead of drag, it will spawn the model on the center of the viewport on the ground, with a message saying that you can use drag and drop.
The implementation could be changed to show a cursor where the model will be spawned. That could be something similar to https://aframe-xr-starterkit.glitch.me/ AR mode with the shadow of the object.
In this way drag and drop vs. click and place is actually much the same.

@kfarr
Copy link

kfarr commented May 20, 2023

@vincentfretin that's a really good idea, building on that: As a user hovers over a model the destination cursor is shown at the default location. If they click, it will be spawned in that location. If they click to drag the model onto the scene, the cursor previews the drop zone where the model will be placed upon click up. Best of both worlds!

@vincentfretin
Copy link
Member Author

drag n drop in FrameVR https://twitter.com/frame_vr/status/1674160651667906560 🔥

@vincentfretin vincentfretin self-assigned this Jul 12, 2023
@vincentfretin vincentfretin added $100 enhancement New feature or request labels Jul 14, 2023
@vincentfretin
Copy link
Member Author

You can sponsor $100 to vincentfretin fully or partially to work on this feature. Find other work you can sponsor at https://github.com/c-frame/sponsorship

@vincentfretin
Copy link
Member Author

@3DStreet sponsored me to work on this issue. Thank you!

@vincentfretin
Copy link
Member Author

As part of this work where you can drag and drop defined glb in a library, I'll also define an api to register primitives to be drag and dropped (see my comment #3 (comment)).
It may also be interesting for you @kfarr to be able to register mixin as draggable primitive somehow because you're using them associated with gtlf-model in 3dstreet. I'll write a proposal of the registration api when I'll start to work on it.

@kfarr
Copy link

kfarr commented Aug 9, 2023

@vincentfretin Our use case will basically come from a JSON list but if there is an API then I'm sure it could be simple to parse said JSON and iterate through it making the api call for each, so very open to whatever you propose, thanks for thinking through multiple use cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants