Everywhere Action: Emphasize on Click
Example for adding custom USDZ behaviours for iOS AR
This is an USDZ / iOS AR only example
export class EmphasizeOnClick extends Behaviour implements UsdzBehaviour {
@serializable()
target?: Object3D;
@serializable()
duration: number = 0.5;
@serializable()
motionType: MotionType = MotionType.bounce;
beforeCreateDocument() { }
createBehaviours(ext, model, _context) {
if (!this.target) return;
if (model.uuid === this.gameObject.uuid) {
const emphasize = new BehaviorModel("emphasize " + this.name,
TriggerBuilder.tapTrigger(this.gameObject),
ActionBuilder.emphasize(this.target, this.duration, this.motionType, undefined, "basic"),
);
ext.addBehavior(emphasize);
}
}
afterCreateDocument(_ext, _context) { }
}