Unity-Technologies / Unity-Technologies/Unity.Mathematics

More implicit conversion

Open
#68 2 comments 9 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 would like to see implicit casting for:

  • int2 <=> Vector2Int
  • int3 <=> Vector3Int

(I have no idea why those don't exist)

  • Vector3 <=> float2
    (usefull when using vector functions like Camera.WorldToScreenPoint in 2D)

Second one will make my code a lot easier to read, instead of
(Vector2)camera.WorldToScreenPoint(float3(currentWorldspaceAimCentre, 0));
I will be able to just do
camera.WorldToScreenPoint(currentWorldspaceAimCentre)

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 definitions of int2, int3, Vector2Int, Vector3Int, Vector3, and float2, then inspect how existing conversions are declared. Verify that the requested conversions support the code examples in the issue without explicit casts and that the project still builds and tests successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
computer-graphics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.