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

three dimensional cosmic text #104

Closed
wants to merge 7 commits into from
Closed

three dimensional cosmic text #104

wants to merge 7 commits into from

Conversation

bytemunch
Copy link
Collaborator

@bytemunch bytemunch commented Oct 27, 2023

closes #98

starwar

Bit jank at the moment, considering either adding StandardMaterial cases to the render function, or reworking how the render function draws.

Todo:

  • Mouse click + hover on 3D widgets
  • Integrate 3D rendering OR
  • Simplify main render function to be target agnostic (Maybe comes back to the everything as a sprite idea?) Simplify main render system #106

@Dimchikkk
Copy link
Owner

Dimchikkk commented Oct 27, 2023

so cool... moving cursor by mouse click doesn't work... https://github.com/StaffEngineer/bevy_cosmic_edit/blob/2ea39ed6a11aac865305db3206acf0d370400808/src/input.rs#L148 considers only 2d for x, y calc.

@bytemunch
Copy link
Collaborator Author

Yeah, gonna need to reverse project the mouse position or something raycasty

@Dimchikkk
Copy link
Owner

@bytemunch

In 3d example text is rendered to plane, in theory we could consider any shape, like rendering text on 3d sphere but then it becomes quite challenging, so restricting 3d for only plane surfaces is good first step.

On mouse click we use this func for calculating x, y: https://github.com/StaffEngineer/bevy_cosmic_edit/blob/2ea39ed6a11aac865305db3206acf0d370400808/src/lib.rs#L502

I think it should be changed to https://docs.rs/bevy/latest/bevy/render/camera/struct.Camera.html#method.viewport_to_world in case of 3d.

Also this func may be useful https://docs.rs/bevy/latest/bevy/math/struct.Ray.html#method.intersect_plane if we consider only plane surfaces for now.

@bytemunch
Copy link
Collaborator Author

I think interacting with the plane will generalize quite nicely to all shapes, we're only interested in the click's UV coords which shouldn't be too hard to get hold of. Might look into whether bevy_mod_picking gives the coords we need? Afk today tho so might be a while before I can check it all out

@Dimchikkk
Copy link
Owner

Dimchikkk commented Oct 28, 2023

@Dimchikkk
Copy link
Owner

I think interacting with the plane will generalize quite nicely to all shapes, we're only interested in the click's UV coords which shouldn't be too hard to get hold of. Might look into whether bevy_mod_picking gives the coords we need? Afk today tho so might be a while before I can check it all out

Yeah, if we go with all shapes it makes sense to use existing solutions like bevy_mod_picking.

@Dimchikkk
Copy link
Owner

@Dimchikkk
Copy link
Owner

I think interacting with the plane will generalize quite nicely to all shapes, we're only interested in the click's UV coords which shouldn't be too hard to get hold of. Might look into whether bevy_mod_picking gives the coords we need? Afk today tho so might be a while before I can check it all out

any idea how to get UV coords? :)

@bytemunch
Copy link
Collaborator Author

any idea how to get UV coords? :)

Having a mare with rebasing or something git related at the moment lol will be looking into this once I figure out how to put new changes on an old branch. Might just close this PR and make a new one save the headache

bytemunch and others added 4 commits November 13, 2023 14:42
update to latest main

i still hate the online conflict resolver, need to look into how I make vim do that stuff instead
@bytemunch
Copy link
Collaborator Author

research keeps using big words like "parametric" and "orthogonal", i don't think I have the brainpower to tackle this today. bevy_mod_raycast gives easy access to world position of the click but I can't figure out all the transforms to get that coordinate in local space relative to the plane, especially when taking into account translation and rotation.. vector math crash course on the horizon for me it seems haha.

tl;dr: maths make sam brain go sad

@Dimchikkk
Copy link
Owner

Dimchikkk commented Nov 13, 2023

@bytemunch have you seen https://github.com/tigregalis/bevy-intersect-plane ? there is basic math there for "parametric" and "orthogonal" I believe ;-)

@bytemunch
Copy link
Collaborator Author

@bytemunch have you seen https://github.com/tigregalis/bevy-intersect-plane ? there is basic math there for "parametric" and "orthogonal" I believe ;-)

Does look very helpful, I'll see if I have time tomorrow to take a look with fresh eyes, hopefully things will make more sense then. I had a couple pieces of the puzzle but didn't get to the full solution, nice to know it's already been done and I can yoink in the name of open source!

Does seem plane specific but I think we can leave typing on spheres to a future endeavour.

Nice that it doesn't depend on any raycast plugins too, keeps footprint small :D

@Dimchikkk
Copy link
Owner

Let's re-open if/once active :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add/Test 3d example for 3d space
2 participants