50 lines
930 B
C
50 lines
930 B
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "entity/entitybase.h"
|
|
|
|
typedef struct {
|
|
vec3 min;
|
|
vec3 max;
|
|
} entitytrigger_t;
|
|
|
|
/**
|
|
* Initializes the trigger component with zeroed bounds.
|
|
*/
|
|
void entityTriggerInit(
|
|
const entityid_t entityId,
|
|
const componentid_t componentId
|
|
);
|
|
|
|
/**
|
|
* Returns a pointer to the trigger component data.
|
|
*/
|
|
entitytrigger_t * entityTriggerGet(
|
|
const entityid_t entityId,
|
|
const componentid_t componentId
|
|
);
|
|
|
|
/**
|
|
* Returns true if the given world-space point lies within [min, max].
|
|
*/
|
|
bool_t entityTriggerContains(
|
|
const entityid_t entityId,
|
|
const componentid_t componentId,
|
|
const vec3 point
|
|
);
|
|
|
|
/**
|
|
* Sets both bounds at once.
|
|
*/
|
|
void entityTriggerSetBounds(
|
|
const entityid_t entityId,
|
|
const componentid_t componentId,
|
|
const vec3 min,
|
|
const vec3 max
|
|
);
|