Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

melonJS Vector and Matrix Maths

Stops the silent vector and matrix bugs in melonJS games, like dropped depth values and slow clones.

Claude's review

8/10 Deep, accurate melonJS vector and matrix gotchas (mutation, pool cost, argument defaults) a game developer would not otherwise know.

We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.

In detail

Use this skill for vector and matrix maths in melonJS — Vector2d, Vector3d, their observable variants, Matrix2d, Matrix3d, and the math utility functions. Covers which methods mutate and which allocate, the vector pool and when clone() is the wrong tool, interpolation with lerp, slerp, damp and moveTowards, and the argument defaults that silently drop a component. Triggers on: Vector2d, Vector3d, ObservableVector2d, ObservableVector3d, Matrix2d, Matrix3d, Quaternion, vector, vector maths, dot, cross, normalize, length, distance, angle, lerp, slerp, damp, moveTowards, project, clamp, degToRad, radToDeg, clone, vector pool, vector3dPool, setMuted, setCallback, my vector is wrong, z is zero, scale ignores z, moveTowards ignores z, setPosition, projectN, currentTransform, setTransform, matrix, transform matrix, column-major, val, Float32Array, basis matrix, orientation matrix, Noise, getNoise1d, flicker, wobble, Color, toArray, color components.

How you use it

  1. Add it to your pack, then download your pack (1 credit).
  2. In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
  3. Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide

Safety check

Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: melonjs-math
description: "Use this skill for vector and matrix maths in melonJS — Vector2d, Vector3d, their observable variants, Matrix2d, Matrix3d, and the math utility functions. Covers which methods mutate and which allocate, the vector pool and when clone() is the wrong tool, interpolation with lerp, slerp, damp and moveTowards, and the argument defaults that silently drop a component. Triggers on: Vector2d, Vector3d, ObservableVector2d, ObservableVector3d, Matrix2d, Matrix3d, Quaternion, vector, vector maths, dot, cross, normalize, length, distance, angle, lerp, slerp, damp, moveTowards, project, clamp, degToRad, radToDeg, clone, vector pool, vector3dPool, setMuted, setCallback, my vector is wrong, z is zero, scale ignores z, moveTowards ignores z, setPosition, projectN, currentTransform, setTransform, matrix, transform matrix, column-major, val, Float32Array, basis matrix, orientation matrix, Noise, getNoise1d, flicker, wobble, Color, toArray, color components."
license: MIT
---

# Vectors, matrices and maths

## The one rule that explains most surprises

**Methods mutate `this` and return it. They do not return a new vector.**

```js
const a = new Vector3d(1, 0, 0);
const b = new Vector3d(0, 1, 0);

a.cross(b);        // a IS NOW the cross product; the original a is gone
a.add(b).normalize().scale(3, 3, 3);   // chains, all in place
```

That is what makes the API allocation-free, and it is the opposite of what a
functional style expects. If you need to keep the original, copy into
something you own first:

```js
out.copy(a).cross(b);    // a untouched, nothing allocated
```

**The exceptions are named.** A handful of methods return a NEW vector, and
each has a `*Self` sibling that does not:

| allocates a new vector | mutates in place |
|---|---|
| `negate()` | `negateSelf()` |
| `floor()` | `floorSelf()` |
| `ceil()` | `ceilSelf()` |
| `clamp(low, high)` | `clampSelf(low, high)` |
| `clone()` | `copy(v)` |

So `v.negate()` in a per-frame loop allocates every frame and `v.negateSelf()`
...

From melonjs's repository, MIT licence.

Related skills

  • Checked

    Game Audio Mixing

    Sets up game audio buses, volume sliders, music ducking and adaptive music for Godot, Unity or FMOD.

    by gamedev-skills 13k
    8/101 credit
  • Checked

    Game camera tuning

    Builds and tunes follow, orbit and first person game cameras in Godot or Cinemachine so they stop jittering.

    by gamedev-skills 13k
    8/101 credit
  • Checked

    Game Enemy AI

    Designs enemy AI with perception, pathfinding and steering so enemies chase fairly and never get stuck.

    by gamedev-skills 13k
    8/101 credit
  • Checked

    Game Loop and Timing

    Makes movement, timers and physics behave the same at any frame rate in Unity, Godot, Bevy and web games.

    by makifbaysal 123
    7/101 credit
  • Checked

    Godot Game Testing

    Writes and runs Godot tests with gdUnit4 or GUT, including scene tests and headless runs that report real results.

    by makifbaysal 123
    7/101 credit
  • Checked

    Game Security Review

    Reviews Unity, Godot and Unreal code for cheats that hurt other players, purchase exploits and unsafe save files.

    by makifbaysal 123
    7/101 credit

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added