Collider
Type | Name | Interface Description |
---|---|---|
Variables | isTangible: boolean | Whether a collision occurs |
Example
collider.isTangible = false;
Use Case
// isTangible (trigger)
@customNode()
export class Use Case_Collider_isTangible extends BasicScriptNode {
@input() sceneObject: APJS.SceneObject;
@output() info: string;
execute() {
const collider = this.sceneObject.getComponent('Collider') as APJS.Collider;
if (!collider) return;
const prev = collider.isTangible;
this.info = `isTangible was ${prev}`;
collider.isTangible = !prev;
}
}
Type | Name | Interface Description |
---|---|---|
Variables | physicsMaterial: PhysicsMaterial | null | Physical Property Material |
Example
const mat = collider.physicsMaterial;
Use Case
// physicsMaterial
@customNode()
export class Use Case_Collider_physicsMaterial extends BasicScriptNode {
@input() sceneObject: APJS.SceneObject;
@output() info: string;
execute() {
const collider = this.sceneObject.getComponent('Collider') as APJS.Collider;
if (!collider) return;
const mat = collider.physicsMaterial;
this.info = mat
? `physicsMaterial: friction=${mat.staticFriction}, bounciness=${mat.bounciness}`
: `physicsMaterial: null`;
//collider.physicsMaterial = new APJS.PhysicsMaterial(0.5, 0.2);
}
}
Type | Name | Interface Description |
---|---|---|
Variables | center: Vector3f | Collision Body Center Position |
Example
collider.center = new APJS.Vector3f(0, 1, 0);
Use Case
// center
@customNode()
export class Use Case_Collider_center extends BasicScriptNode {
@input() sceneObject: APJS.SceneObject;
@output() info: string;
execute() {
const collider = this.sceneObject.getComponent('Collider') as APJS.Collider;
if (!collider) return;
const center = collider.center;
this.info = `center: (${center.x}, ${center.y}, ${center.z})`;
collider.center = new APJS.Vector3f(0, 1, 0);
}
}
Type | Name | Interface Description |
---|---|---|
Variables | rotation: Quaternionf | Collider Rotation (Quaternion) |
Example
collider.rotation = new APJS.Quaternionf(0, 0, 0, 1);
Use Case
// rotation (Quaternion)
@customNode()
export class Use Case_Collider_rotation extends BasicScriptNode {
@input() sceneObject: APJS.SceneObject;
@output() info: string;
execute() {
const collider = this.sceneObject.getComponent('Collider') as APJS.Collider;
if (!collider) return;
const rot = collider.rotation;
this.info = `rotation: (${rot.x}, ${rot.y}, ${rot.z}, ${rot.w})`;
collider.rotation = new APJS.Quaternionf(0, 0, 0, 1); // Identity quaternion
}
}
Type | Name | Interface Description |
---|---|---|
Variables | eulerAngles: Vector3f (in Degree) | Collider Rotation Euler Angles |
Example
collider.eulerAngles = new APJS.Vector3f(0, 45, 0);
Use Case
// eulerAngles
@customNode()
export class Use Case_Collider_eulerAngles extends BasicScriptNode {
@input() sceneObject: APJS.SceneObject;
@output() info: string;
execute() {
const collider = this.sceneObject.getComponent('Collider') as APJS.Collider;
if (!collider) return;
const euler = collider.eulerAngles;
this.info = `eulerAngles: (${euler.x}, ${euler.y}, ${euler.z})`;
collider.eulerAngles = new APJS.Vector3f(0, 45, 0);
}
}
Type | Name | Interface Description |
---|---|---|
Variables | interactable: boolean (can be interact using interactor node) | Whether it is possible to drag with the mouse (using the drag interaction node) |
Example
collider.interactable = false;
Use Case
// interactable
@customNode()
export class Use Case_Collider_interactable extends BasicScriptNode {
@input() sceneObject: APJS.SceneObject;
@output() info: string;
execute() {
const collider = this.sceneObject.getComponent('Collider') as APJS.Collider;
if (!collider) return;
const prev = collider.interactable;
this.info = `interactable was ${prev}`;
collider.interactable = !prev;
}
}