Token导航 LogoToken导航

Agent Skill · 开发

unity-3d-math(Unity 3D math 命令行)

unity-3d-math 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

unity-3d-math 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 17,697。

总安装 388周安装 16GitHub Stars 14下载 127核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:unity-3d-math(Unity 3D math 命令行)
来源仓库:https://github.com/nice-wolf-studio/unity-claude-skills
仓库路径:skills/unity-3d-math
安装命令:
npx skills add https://github.com/nice-wolf-studio/unity-claude-skills --skill unity-3d-math
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/nice-wolf-studio/unity-claude-skills --skill unity-3d-math

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合在需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库和原始 README 核验具体用法。安装前建议确认权限范围、维护状态及是否会触发联网或文件读写。

unity-3d-math 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/unity-3d-math

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/nice-wolf-studio/unity-claude-skills --skill u…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

unity-3d-math 怎么安装?

在终端执行 npx skills add https://github.com/nice-wolf-studio/unity-claude-skills --skill unity-3d-ma…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

unity-3d-math 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

unity-3d-math 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

unity-3d-math 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

unity-3d-math 用的人多吗?

公开数据是累计安装 388 次,近一周安装 16 次,下载 127 次,GitHub 14 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

unity-3d-math 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
unity-3d-math

Unity 3D math 命令行 · 本页

38814需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

3D Math & Spatial Reasoning -- Correctness Patterns

Prerequisite skills: unity-scripting (Vector3/Quaternion API), unity-foundations (Transform, GameObjects), unity-physics (raycasting basics)

These patterns target the most dangerous Claude failure mode: plausible-looking math that compiles but produces wrong results. Each pattern documents Claude's default mistake and the correct Unity approach.


PATTERN: Coordinate Space -- TransformPoint vs TransformDirection

WHEN: Converting between local and world space

WRONG (Claude default):

// Using TransformDirection for a position offset
Vector3 worldPos = transform.TransformDirection(localOffset);

RIGHT:

// Positions: TransformPoint (applies position + rotation + scale)
Vector3 worldPos = transform.TransformPoint(localOffset);

// Directions: TransformDirection (applies rotation only, ignores scale)
Vector3 worldDir = transform.TransformDirection(localDir);

// Vectors: TransformVector (applies rotation + scale, no position)
Vector3 worldVec = transform.TransformVector(localVec);

GOTCHA: TransformDirection ignores scale -- if the parent has non-uniform scale and you need the direction scaled, use TransformVector. For the inverse operations, use InverseTransformPoint, InverseTransformDirection, InverseTransformVector.


PATTERN: Quaternion Multiplication Order

WHEN: Combining rotations (e.g., applying a local rotation on top of a world rotation)

WRONG (Claude default):

// "First rotate by A, then rotate by B"
transform.rotation = rotA * rotB; // Actually applies B first, then A

RIGHT:

// Quaternion multiplication applies RIGHT operand first
// "Apply B in A's space" = A * B
// Parent-then-child: parent * child
transform.rotation = worldRotation * localRotation;

// Example: rotate 45 degrees around Y, then tilt 30 degrees around local X
Quaternion yaw = Quaternion.AngleAxis(45f, Vector3.up);
Quaternion pitch = Quaternion.AngleAxis(30f, Vector3.right);
transform.rotation = yaw * pitch; // yaw is applied in world, pitch in yaw's local space

GOTCHA: This is the opposite of matrix multiplication reading order. If you think "first A then B", write A * B -- the right operand is applied in the left operand's local space.


PATTERN: Euler Angle Interpolation (Gimbal Lock)

WHEN: Smoothly rotating between two orientations

WRONG (Claude default):

// Interpolating euler angles directly
Vector3 currentEuler = Vector3.Lerp(startEuler, endEuler, t);
transform.eulerAngles = currentEuler;

RIGHT:

// Always interpolate quaternions, never euler angles
transform.rotation = Quaternion.Slerp(startRot, endRot, t);

// For small angles where performance matters, Lerp is acceptable
transform.rotation = Quaternion.Lerp(startRot, endRot, t); // Slightly faster, less accurate for large arcs

GOTCHA: Euler angles suffer from gimbal lock at 90-degree pitch and have discontinuities (e.g., 359 to 1 degree jumps through 358 degrees instead of 2). Quaternion.Slerp always takes the shortest path. Use Quaternion.Lerp only when the angular difference is small (< 45 degrees).


PATTERN: Quaternion.LookRotation Zero Vector

WHEN: Rotating an object to face a target direction

WRONG (Claude default):

Vector3 dir = target.position - transform.position;
transform.rotation = Quaternion.LookRotation(dir);

RIGHT:

Vector3 dir = target.position - transform.position;
if (dir.sqrMagnitude > 0.0001f) // Guard against zero/near-zero vector
{
    transform.rotation = Quaternion.LookRotation(dir, Vector3.up);
}

GOTCHA: LookRotation(Vector3.zero) produces NaN quaternion that silently corrupts the transform. The forward parameter does not need to be normalized (Unity normalizes internally), but it MUST be non-zero. Also fails if forward is exactly parallel to up -- the second parameter defaults to Vector3.up, which breaks if the target is directly above/below.


PATTERN: Never Modify Quaternion Components Directly

WHEN: Trying to zero out or modify a specific rotation axis

WRONG (Claude default):

// "Remove the X rotation"
Quaternion rot = transform.rotation;
rot.x = 0f;
transform.rotation = rot;

RIGHT:

// Extract euler, modify, rebuild
Vector3 euler = transform.eulerAngles;
euler.x = 0f;
transform.rotation = Quaternion.Euler(euler);

// Or use Quaternion factory methods
// Keep only Y rotation:
transform.rotation = Quaternion.Euler(0f, transform.eulerAngles.y, 0f);

GOTCHA: Quaternion x/y/z/w are NOT euler angles. They are components of a 4D unit quaternion. Setting .x = 0 produces a non-unit quaternion with undefined behavior. Always use factory methods: Quaternion.Euler(), Quaternion.AngleAxis(), Quaternion.LookRotation().


PATTERN: Float Comparison

WHEN: Comparing positions, distances, or any floating-point values

WRONG (Claude default):

if (transform.position == targetPosition) { /* arrived */ }
if (distance == 0f) { /* overlapping */ }

RIGHT:

// For positions: use sqrMagnitude with epsilon
if ((transform.position - targetPosition).sqrMagnitude < 0.0001f) { /* arrived */ }

// For single floats: use Mathf.Approximately
if (Mathf.Approximately(distance, 0f)) { /* close enough */ }

// For custom tolerance:
const float epsilon = 0.01f;
if (Mathf.Abs(a - b) < epsilon) { /* within tolerance */ }

GOTCHA: Vector3 == Vector3 in Unity does use an approximate comparison internally (epsilon ~1e-5), but it is often too tight for gameplay logic. Use explicit thresholds matching your game's precision needs. Never use == with calculated floats that accumulated error.


PATTERN: Vector3.Angle is Always Positive

WHEN: Determining turn direction (left vs right, clockwise vs counter-clockwise)

WRONG (Claude default):

float angle = Vector3.Angle(transform.forward, dirToTarget);
// angle is always 0-180, cannot tell left from right

RIGHT:

// SignedAngle returns -180 to +180 relative to the specified axis
float signedAngle = Vector3.SignedAngle(transform.forward, dirToTarget, Vector3.up);
// Positive = target is to the right, Negative = target is to the left (when axis is up)

GOTCHA: The sign depends on the axis parameter. With Vector3.up as axis: positive = clockwise when viewed from above. Choose the axis that matches your rotation plane. For 2D games using XY plane, use Vector3.forward as the axis.


PATTERN: Cross Product Order and Handedness

WHEN: Computing normals, perpendicular vectors, or winding order

WRONG (Claude default):

// Assuming right-hand rule
Vector3 normal = Vector3.Cross(edge1, edge2);

RIGHT:

// Unity uses a LEFT-handed coordinate system (Y-up, Z-forward)
// Cross product follows LEFT-hand rule:
// Cross(right, forward) = UP (not down)
Vector3 normal = Vector3.Cross(edge1, edge2);
// If normal points wrong way, swap operand order:
Vector3 flippedNormal = Vector3.Cross(edge2, edge1);

GOTCHA: Unity is left-handed (Y-up, X-right, Z-forward). OpenGL/Blender are right-handed. If you're porting math from a right-handed reference, you need to flip the cross product order OR negate one axis. Triangle winding is clockwise = front-facing in Unity.


PATTERN: sqrMagnitude for Distance Comparisons

WHEN: Comparing distances in performance-sensitive code (Update loops, many objects)

WRONG (Claude default):

// Vector3.Distance computes a square root every call
if (Vector3.Distance(a, b) < detectionRange)
{
    // detected
}

RIGHT:

// Compare squared distances -- avoids sqrt
float sqrRange = detectionRange * detectionRange;
if ((a - b).sqrMagnitude < sqrRange)
{
    // detected
}

GOTCHA: Cache sqrRange outside the loop -- do not recompute range * range per iteration. This optimization matters when checking N objects per frame (O(N) sqrt calls). For single checks, Vector3.Distance is perfectly fine -- do not micro-optimize one-off calls.


PATTERN: Camera.ScreenToWorldPoint Z Depth

WHEN: Converting a screen position (mouse, touch) to a world position

WRONG (Claude default):

// z=0 gives a point ON the camera's near plane, not in the scene
Vector3 worldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

RIGHT:

// Set z to the desired distance from the camera
Vector3 screenPos = Input.mousePosition;
screenPos.z = desiredDistance; // Distance from camera along its forward axis
Vector3 worldPos = Camera.main.ScreenToWorldPoint(screenPos);

GOTCHA: The z component of the input vector is the distance from the camera in world units along the camera's forward direction. For perspective cameras, z=0 returns a point at the camera's position. For orthographic cameras, z doesn't affect x/y but still sets depth. To place objects on a ground plane, use Physics.Raycast with Camera.ScreenPointToRay instead.


PATTERN: Camera.ViewportToWorldPoint

WHEN: Placing objects at viewport edges (HUD bounds, screen limits)

WRONG (Claude default):

// Missing z depth -- returns a point at the camera
Vector3 topRight = Camera.main.ViewportToWorldPoint(new Vector3(1f, 1f, 0f));

RIGHT:

// z = distance from camera where you want the world point
float distFromCamera = 10f;
Vector3 topRight = Camera.main.ViewportToWorldPoint(new Vector3(1f, 1f, distFromCamera));
Vector3 bottomLeft = Camera.main.ViewportToWorldPoint(new Vector3(0f, 0f, distFromCamera));

GOTCHA: Viewport coordinates are normalized: (0,0) = bottom-left, (1,1) = top-right. The z value is NOT a Z world coordinate -- it is the distance from the camera. This matters for perspective cameras where the frustum widens with distance.


PATTERN: Plane.Raycast Semantics

WHEN: Finding where a ray intersects a mathematical plane

WRONG (Claude default):

Plane groundPlane = new Plane(Vector3.up, 0f);
float enter;
groundPlane.Raycast(ray, out enter);
Vector3 hitPoint = ray.GetPoint(enter); // Using enter without checking return value

RIGHT:

Plane groundPlane = new Plane(Vector3.up, 0f); // Normal=up, distance=0 (XZ plane at origin)
float enter;
if (groundPlane.Raycast(ray, out enter))
{
    Vector3 hitPoint = ray.GetPoint(enter);
}
// If returns false, the ray points away from the plane (enter is negative)

GOTCHA: Plane.Raycast returns true only when the ray intersects the plane's front side (the side the normal points toward). If the ray origin is behind the plane or pointing away, it returns false and enter is negative. The Plane constructor new Plane(normal, distance) -- the distance is the signed distance from origin along the normal. new Plane(Vector3.up, 5f) creates a plane at y = -5, NOT y = 5. Use new Plane(Vector3.up, new Vector3(0, 5, 0)) for a plane at y = 5.


PATTERN: Bounds is Always Axis-Aligned (AABB)

WHEN: Checking spatial overlap or containment of rotated objects

WRONG (Claude default):

// Assuming bounds rotates with the object
if (renderer.bounds.Contains(point))
{
    // This is an AABB check, not an OBB check
}

RIGHT:

// renderer.bounds is an AXIS-ALIGNED bounding box in WORLD space
// It expands to encompass the rotated mesh, making it larger than the actual object
Bounds aabb = renderer.bounds;

// For oriented checks, use the collider or manual OBB:
// Option 1: Use a collider (accurate to shape)
Collider col = GetComponent<Collider>();
Vector3 closest = col.ClosestPoint(point);
bool inside = (closest - point).sqrMagnitude < 0.0001f;

// Option 2: Transform point to local space for local-space AABB check
Vector3 localPoint = transform.InverseTransformPoint(point);
Bounds localBounds = meshFilter.sharedMesh.bounds; // Local-space bounds
bool containsLocal = localBounds.Contains(localPoint);

GOTCHA: Renderer.bounds returns world-space AABB. Rotating an object makes its AABB grow (a rotated cube's AABB is larger than the cube). Mesh.bounds is local-space. For Bounds.Intersects(other), both must be in the same space. Collider.bounds is also AABB -- for precise shape checks use Physics.ComputePenetration or Collider.ClosestPoint.


PATTERN: Transform Hierarchy Scale Inheritance

WHEN: Working with parent/child transforms that have non-uniform scale

WRONG (Claude default):

// Assuming scale is independent
transform.localScale = Vector3.one; // Visually one-to-one? Not if parent is scaled

RIGHT:

// lossyScale gives the approximate world-space scale (read-only)
Vector3 worldScale = transform.lossyScale;

// To set a specific world-space scale on a child:
Vector3 parentScale = transform.parent.lossyScale;
transform.localScale = new Vector3(
    desiredWorldScale.x / parentScale.x,
    desiredWorldScale.y / parentScale.y,
    desiredWorldScale.z / parentScale.z
);

GOTCHA: lossyScale is only approximate when the hierarchy contains rotation + non-uniform scale (skew). Unity does not support skew in transforms, so lossyScale may not perfectly represent the visual scale. Avoid non-uniform scale on parents of rotated children. SetParent(parent, true) preserves world position/rotation/scale; SetParent(parent, false) keeps local values -- choose intentionally.


Common Patterns Quick Reference

NeedMethodSpace
Position local-to-worldTransformPointlocal -> world
Position world-to-localInverseTransformPointworld -> local
Direction local-to-worldTransformDirectionrotation only
Direction world-to-localInverseTransformDirectionrotation only
Vector local-to-worldTransformVectorrotation + scale
Angle between vectorsVector3.Angleunsigned 0-180
Signed angleVector3.SignedAngle-180 to +180
Dot product > 0vectors face same hemisphere
Dot product == 0vectors are perpendicular
Dot product < 0vectors face opposite directions
Mouse to world rayCamera.ScreenPointToRayscreen -> world
Mouse to world pointScreenToWorldPoint + z depthscreen -> world
Viewport edge to worldViewportToWorldPoint + z depthviewport -> world

Related Skills

  • unity-scripting -- Vector3, Quaternion, Time API reference
  • unity-foundations -- Transform API, parent/child hierarchies
  • unity-physics -- Raycasting, collider spatial queries
  • unity-physics-queries -- Physics query correctness patterns

Additional Resources

平台分布

Codex

37.8%
按下载量换算48

Claude

31.52%
按下载量换算40

Cursor

18.56%
按下载量换算24

Gemini CLI

8.94%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills