Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / ColliderState

Type Alias: ColliderState

ts
type ColliderState = {
  enabled: boolean;
  shape: ColliderShape;
  offsetPosition: {
     x: number;
     y: number;
     z: number;
  };
  offsetRotation: {
     x: number;
     y: number;
     z: number;
  };
  size: {
     x: number;
     y: number;
     z: number;
  };
  radius: number;
  height: number;
  restitution: number;
  friction: number;
  isSensor: boolean;
};

Defined in: components/Physics.ts:91

Authoring state for the collider half of PhysicsComponent. Only the size fields relevant to ColliderState.shape are read at simulation time.

Properties

PropertyTypeDescriptionDefined in
enabledbooleanWhen false, the collider is removed from physics simulation but kept in state.components/Physics.ts:93
shapeColliderShapeCollider primitive shape.components/Physics.ts:95
offsetPosition{ x: number; y: number; z: number; }Local offset of the collider relative to the entity's transform, in world units.components/Physics.ts:97
offsetPosition.xnumberOffset along local X.components/Physics.ts:99
offsetPosition.ynumberOffset along local Y.components/Physics.ts:101
offsetPosition.znumberOffset along local Z.components/Physics.ts:103
offsetRotation{ x: number; y: number; z: number; }Local rotation offset in radians (Euler XYZ).components/Physics.ts:106
offsetRotation.xnumberRotation around local X (radians).components/Physics.ts:108
offsetRotation.ynumberRotation around local Y (radians).components/Physics.ts:110
offsetRotation.znumberRotation around local Z (radians).components/Physics.ts:112
size{ x: number; y: number; z: number; }Half-extents for cuboid shape, in world units.components/Physics.ts:115
size.xnumberHalf-extent along X.components/Physics.ts:117
size.ynumberHalf-extent along Y.components/Physics.ts:119
size.znumberHalf-extent along Z.components/Physics.ts:121
radiusnumberRadius for ball, capsule, and cylinder shapes.components/Physics.ts:124
heightnumberHeight for capsule (segment length between caps) and cylinder.components/Physics.ts:126
restitutionnumberBounciness in [0, 1]. 0 is no bounce; 1 is perfectly elastic.components/Physics.ts:128
frictionnumberSurface friction coefficient. 0 is frictionless.components/Physics.ts:130
isSensorbooleanWhen true, the collider reports overlaps but does not generate contact responses.components/Physics.ts:132