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

Let Gizmos support arcs in 3D #11536

Closed
RobWalt opened this issue Jan 26, 2024 · 1 comment
Closed

Let Gizmos support arcs in 3D #11536

RobWalt opened this issue Jan 26, 2024 · 1 comment
Labels
A-Gizmos Visual editor and debug gizmos C-Feature A new feature, making something new possible

Comments

@RobWalt
Copy link
Contributor

RobWalt commented Jan 26, 2024

What problem does this solve or what need does it fill?

Currently we don't have the functionality of drawing 3D arcs with gizmos. This is useful for drawing any kind of compound shape however.

What solution would you like?

Initial thoughts (just here for documentation of the process) I explored the APIs of other engines for this and documented my findings [here](https://github.com//pull/11072#issuecomment-1882755344). It seems that it would make most sense to replicate unity's API because:
  1. It's the easiest way for a first implementation
  2. People switching engines instantly feel "home"

Update:

I opted for a custom implementation in the end. The unity-like implementation had some flaws and other unintuitive quirks. I think the API should draw orientation from easy to get mental models for placement/orientation/general configuration of the arcs. I went for a combination of:

  • the builder pattern we already had
  • intuitive (?) defaults
  • extensions of the builder pattern to the maximum

What alternative(s) have you considered?

Initial thoughts (just here for documentation of the process) I searched for the implementations in other engines and even tried to come up with an original approach myself but unity's API. Compared to unity's API there were too many cons to follow these paths further.

Update:

I looked into other implementations of similar APIs and documented this here. I even implemented the unity API in the first implementation of this issue but that was not really feeling good in the end when I tried to use it in the examples.

Additional context

The functionality for this is already there. I'll cherry-pick it from another PR branch, open a distinct one just for this feature and link it here.

@RobWalt RobWalt added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 26, 2024
@Kanabenki Kanabenki added A-Gizmos Visual editor and debug gizmos and removed S-Needs-Triage This issue needs to be labelled labels Jan 26, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 28, 2024
# Objective

- Implement an arc3d API for gizmos
- Solves #11536

## Solution

### `arc_3d`

- The current `arc3d` method on gizmos only takes an angle
- It draws an "standard arc" by default, this is an arc starting at
`Vec3::X`, in the XZ plane, in counter clockwise direction with a normal
that is facing up
- The "standard arc" can be customized with the usual gizmo builder
pattern. This way you'll be able to draw arbitrary arcs

### `short/long_arc_3d_between`

- Given `center`, `from`, `to` draws an arc between `from` and `to`

---

## Changelog

> This section is optional. If this was a trivial fix, or has no
externally-visible impact, you can delete this section.

- Added: `Gizmos::arc3d(&mut self, angle)` method
- Added: `Gizmos::long_arc_3d_between(&mut self, center, from, to)`
method
- Added: `Gizmos::short_arc_3d_between(&mut self, center, from, to)`
method

---

This PR factors out an orthogonal part of another PR as mentioned in
[this
comment](#11072 (comment))
@RobWalt
Copy link
Contributor Author

RobWalt commented Jan 28, 2024

Merged, so closing this 👍

@RobWalt RobWalt closed this as completed Jan 28, 2024
tjamaan pushed a commit to tjamaan/bevy that referenced this issue Feb 6, 2024
# Objective

- Implement an arc3d API for gizmos
- Solves bevyengine#11536

## Solution

### `arc_3d`

- The current `arc3d` method on gizmos only takes an angle
- It draws an "standard arc" by default, this is an arc starting at
`Vec3::X`, in the XZ plane, in counter clockwise direction with a normal
that is facing up
- The "standard arc" can be customized with the usual gizmo builder
pattern. This way you'll be able to draw arbitrary arcs

### `short/long_arc_3d_between`

- Given `center`, `from`, `to` draws an arc between `from` and `to`

---

## Changelog

> This section is optional. If this was a trivial fix, or has no
externally-visible impact, you can delete this section.

- Added: `Gizmos::arc3d(&mut self, angle)` method
- Added: `Gizmos::long_arc_3d_between(&mut self, center, from, to)`
method
- Added: `Gizmos::short_arc_3d_between(&mut self, center, from, to)`
method

---

This PR factors out an orthogonal part of another PR as mentioned in
[this
comment](bevyengine#11072 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Gizmos Visual editor and debug gizmos C-Feature A new feature, making something new possible
Projects
None yet
Development

No branches or pull requests

2 participants