MrGVSV / bevy_proto

Create config files for entities in Bevy
Other
239 stars 25 forks source link

Allow Transform rotations to be defined in euler angles #61

Open Occuros opened 1 year ago

Occuros commented 1 year ago

Current Issue:

Rotations in transformations can only be defined using quaternions (Quat). While this is suitable for engine representation, it is less than ideal for human readability and ease of input.

Desired Solution:

Introduce a custom input type called ProtoTransform that utilizes an enum to specify the rotation type. This would be adopted by all existing custom implementations.

enum ProtoTransform {
    TranformWithQuaternionRotation {
        translation: Vec3,
        rotation: Quat,
        scale: Vec3,
    },
    TransformWithEulerXYZRotation {
        translation: Vec3,
        rotation: Vec3,
        scale: Vec3,
    },
}
MrGVSV commented 1 year ago

I think another way of representing this is to have something like:

impl_external_schematic! {
  #[schematic(from = TransformInput)]
  struct Transform {}

  #[derive(Reflect)]
  struct TransformInput {
    translation: Vec3,
    rotation: RotationInput,
    scale: Vec3,
  }

  enum RotationInput {
    Quat(Quat),
    Euler(Vec3)
  }
}