Unity-Technologies / Unity-Technologies/Unity.Mathematics

[Feature Request] Zeroed swizzle operators (e.g. float3.x__, float3._y_, float3.__z)

Open
#60 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.4k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

I'd find it handy to have zeroed swizzle operators that would let me do something like this:

float3 first = new float3(1f, 2f, 3f);
float3 second = new float3(7f, 8f, 9f);

float3 combined = first.x_z + second._y_; // == new float3(1f, 8f, 3f)

For me, this sometimes seems easier to understand at a glance than having something like:

float3 first = new float3(1f, 2f, 3f);
float3 second = new float3(7f, 8f, 9f);

float3 combined = new float3(first.x, second.y, first.z); // == new float3(1f, 8f, 3f)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the float3 swizzle operator definitions and any related tests or generation entry points; the issue names no files. Check how patterns such as x_z and y should combine components, then consider the request complete when the demonstrated expressions produce the expected float3 values and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.