Skip to content

Helper methods on Transform #14426

@lylythechosenone

Description

@lylythechosenone

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

Currently, working with a transform is cumbersome, requiring many lines to perform simple tasks. This can be seen easily in the translation example:

let direction = transform.local_x();
transform.translation += direction * cube.speed * timer.delta_seconds();

Note that this has to be two lines instead of one, because of borrow checker issues.

What solution would you like?

Simple methods like translate, local_translate would make such operations much simpler. The above could become

transform.local_translate(Vec3::X * cube.speed * timer.delta_seconds());

which is much simpler and easier to understand.

What alternative(s) have you considered?

The original example does work, but as I said, it's quite cumbersome.

Additional context

I know Unity has functions like these, although I don't know how many other engines do. Notably, Godot does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-TransformTranslations, rotations and scalesC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Needs-DesignThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions