Unity-Technologies / Unity-Technologies/Unity.Mathematics

Swizzle property z and w for int2/float2 and w for int3/float3

Open
#224 3 comments 3 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

Please add complete swizzle property to int2 float2 int3 float3 similar to int4 and float4 and define it as 0

So that we could simply upcast vec2 and vec3 to another dimension easily as downcast vec4 to lower dimension

Such as

var screenPoint = new float2(5,3);
var groundPoint = screenPoint.xzy; // (5,0,3)
var wallPoint = screenPoint.zyx; // (0,3,5)

Alternatively it might be xy0 x0y _0xy yx0 y0x _0yx and maybe xy1 x1y _1xy yx1 y1x _1yx and so on for specific default number

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 reading the existing int4 and float4 swizzle properties, then compare how int2, float2, int3, and float3 currently expose their properties. Add the requested z and w combinations with a zero component, and verify that the example upcasts and existing downcasts behave consistently; the alternative constant values remain unresolved in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.