pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber
https://cannon.pmnd.rs
2.76k stars 154 forks source link

Create Triplet Interface #206

Closed bjornstar closed 3 years ago

bjornstar commented 3 years ago

I can update the docs if you're happy with the changes.

drcmda commented 3 years ago

could you make it a named triplet? [number: x, number: y, number: z] ? then we get better IDE context

bjornstar commented 3 years ago

could you make it a named triplet? [number: x, number: y, number: z] ? then we get better IDE context

Sure, already done.

bjornstar commented 3 years ago

Also added names for some of the args:

type CylinderArgs = [radiusTop: number, radiusBottom: number, height: number, numSegments: number]
type TrimeshArgs = [vertices: (THREE.Vector3 | Triplet)[], indices: Triplet[]]
type HeightfieldArgs = [
  data: number[],
  options: { minValue?: number; maxValue?: number; elementSize?: number },
]
type ConvexPolyhedronArgs = [
  vertices: (THREE.Vector3 | Triplet)[],
  faces: number[],
  normals: (THREE.Vector3 | Triplet)[],
]
drcmda commented 3 years ago

nice, could you add it to the docs and then lets merge

bjornstar commented 3 years ago

nice, could you add it to the docs and then lets merge

README has been updated. I tested it out on racing-game, it's nice to have types for the args :)