-
-
Notifications
You must be signed in to change notification settings - Fork 4k
WIP: Fix glTF model forward direction #20135
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
base: main
Are you sure you want to change the base?
Conversation
The generated |
// With higher speed the curvature of the orbit would be smaller. | ||
let incremental_turn_weight = cube.turn_speed * timer.delta_secs(); | ||
let old_rotation = transform.rotation; | ||
transform.rotation = old_rotation.lerp(look_at_sphere.rotation, incremental_turn_weight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be smooth_nudge
nowadays
@@ -317,16 +320,44 @@ impl Transform { | |||
|
|||
/// Equivalent to [`-local_z()`][Transform::local_z] | |||
#[inline] | |||
pub fn forward(&self) -> Dir3 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably deprecate these methods instead of removing them
/// Equivalent to [`-local_z()`][Transform::local_z] if `flip_model_forward` is false, | ||
/// else [`local_z()`][Transform::local_z] | ||
/// | ||
/// glTF has opposing forward directions for cameras and lights, and for models. Model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be asset agnostic, this should not even mention glTF imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we decide to do this, we should only mention glTF in an explanatory note.
fb2bcc4
to
aaa8f70
Compare
@@ -42,6 +42,7 @@ pub(crate) fn node_transform(node: &Node, convert_coordinates: bool) -> Transfor | |||
translation: Vec3::from(translation), | |||
rotation: bevy_math::Quat::from_array(rotation), | |||
scale: Vec3::from(scale), | |||
flip_model_forward: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per @atlv24: let's make this a u8
enum :)
@@ -317,16 +324,44 @@ impl Transform { | |||
|
|||
/// Equivalent to [`-local_z()`][Transform::local_z] | |||
#[inline] | |||
pub fn forward(&self) -> Dir3 { | |||
pub fn camera_forward(&self) -> Dir3 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to cover lights too. Maybe just duplicate methods?
It looks like your PR is a breaking change, but you didn't provide a migration guide. Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes. |
This is to illustrate what I think is needed for the glTF model forward direction being +z.