bevyengine / bevyengine/bevy

Adding utility math functions to GlobalTransform

Open
#15,655 1 comment 0 reactions 0 assignees View on GitHub
A-Transform C-Feature C-Usability D-Straightforward S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

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

Say I have a child entity from an entity with a non zero translation.
If I call look_at on the child's transform, then it will no correctly look at the position since it wouldn't consider the parent offset.

Maybe it's just me that's bad at math but I couldn't figure a way to make that look_at work easily.

## What solution would you like?

I think therefore a good feature would be adding math methods similar to the ones available on the Transform component to the GlobalTransform.

Example (adding a look_at equivalent to GlobalTransform):
`child_transform.rotation = child_global_transform.looking_at(target);`

## What alternative(s) have you considered?

A more ambitious resolution would be to just get rid of this weird and confusing "Global transform can't be changed and also it doesn't update in real time" to what engines like Unity do where it just works for both global_transforms and local_transform seamlessly.

I think this solution is less likely to happen because:
- I'm sure there are valid reasons for this system being that way, probably some ECS shenanigans or smth.
- Transforms are a very central aspect of the engine and changing that would probably require a lot of change.

## Additional context

I don't know much about anything so I may be partly or totally wrong.

Contributor guide

Open the contributing guide

Research direction

Start with the existing math methods on Transform and the GlobalTransform entry point described in the issue. Determine which utility methods should be exposed and how the look_at equivalent should account for a parent's offset. Done means the selected GlobalTransform operations are defined clearly and the child look-at behavior works as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.