🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more
Socket
Book a DemoInstallSign in
Socket

@easytwin/runtime

Package Overview
Dependencies
Maintainers
5
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@easytwin/runtime

Easytwin中间层引擎,提供场景管理/资源管理/自定义动态组件支持

latest
npmnpm
Version
0.0.51
Version published
Maintainers
5
Created
Source

自定义组件

特性

  • 生命周期支持
  • onAwake: 在帧循环前调用,仅会调用一次
  • onStart: 在帧循环最开始调用,仅会调用一次
  • onUpdate: 每帧调用一次
  • onEnable: 组件被启用时调用一次
  • onDisable: 组件被禁用时调用一次
  • 碰撞与射线检测(暂未支持)
  • onPointerUp: 指针在碰撞体上释放时
  • onPointerDown: 指针在碰撞体上按下时
  • onPointerEnter: 指针进入碰撞体
  • onPointerExit: 指针退出碰撞体
  • onPointerClick: 指针点击碰撞体
  • onPointerDrag: 拖动物体时

要点须知

  • VirtualRootComponent用于数字要素模板/模型, VirtualComponent则用于数字要素的子要素/模型内部结构. 如果不需要启用虚拟子组件,请继承Component
  • 要启用射线检测需要让THREE.Object关联 RuntimeComponent,设置THREE.Object.userdata._target = RuntimeComponent;
  • data和state中以$R结尾的字段会被判断为资源路径,要求value是string,参与导入导出。

FAQs

Package last updated on 21 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts