import type { NodeDef } from '../../NodeRegistry'; import { asEntity } from '../../values'; import { bool, obj } from '../shared'; export const IsTouching: NodeDef = { type: 'IsTouching', label: 'Is touching', category: 'data', description: 'Whether the colliders of two objects overlap right now ' + '(an object stands for its collider children; a collider for itself).', inputs: [obj('a'), obj('b')], outputs: [bool('result')], params: [], run: (ctx, inputs) => { const a = asEntity(inputs.a); const b = asEntity(inputs.b); return { outputs: { result: Boolean(a && b && ctx.isTouching(a, b)) } }; }, };