You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
代码直接run,尝试更改了scale但是显示不出来,麻烦帮忙看下是什么问题
import {
Camera,
Logger,
SpriteRenderer,
WebGLEngine,
Engine,
Sprite,
Vector3,
Layer
} from "@galacean/engine";
import { SpineAnimation } from "@galacean/engine-spine";
import { LitePhysics } from "@galacean/engine-physics-lite";
Logger.enable();
export default class {
constructor(options) {
this.options = options;
}
init() {
// 初始化引擎
this.engine = new WebGLEngine(this.options.canvas);
this.engine.canvas.resizeByClientSize();
this.scene = this.engine.sceneManager.activeScene;
this.rootEntity = this.scene.createRootEntity();
this.engine.physicsManager.initialize(LitePhysics);
}
async loadResource() {
const resourceP = this.engine.resourceManager.load([
{
urls: [
"https://gw.alipayobjects.com/os/OasisHub/a66ef194-6bc8-4325-9a59-6ea9097225b1/1620888427489.json",
"https://gw.alipayobjects.com/os/OasisHub/a1e3e67b-a783-4832-ba1b-37a95bd55291/1620888427490.atlas",
"https://gw.alipayobjects.com/zos/OasisHub/a3ca8f62-1068-43a5-bb64-5c9a0f823dde/1620888427490.png",
],
type: "spine",
},
{
url: "https://gw.alicdn.com/imgextra/i1/O1CN01pK6DQP1D1UcoKBURP_!!6000000000156-2-tps-281-270.png"
}
]);
resourceP.onProgress((process) => {
console.log("process", process);
});
this.resourceArr = await resourceP;
}
renderImg({ name, position = new Vector3(0,0,0) }, ...params) {
const imgEntity = this.spineEntity.createChild(name);
const imgRender = imgEntity.addComponent(SpriteRenderer);
}
renderSpine(entity) {
entity.transform.setPosition(0, -15, -50);
console.log('entity.transform', entity.transform)
// entity.transform.
this.spineEntity.addChild(entity);
const spineAnimation = entity.getComponent(SpineAnimation);
spineAnimation.state.setAnimation(0, "walk", true);
spineAnimation.scale = 0.01;
console.log('spineAnimation', spineAnimation.state.tracks);
}
render() {
console.log("this.resourceArr[0]", this.resourceArr);
this.renderSpine(this.resourceArr[0]);
// this.renderImg({}, this.resourceArr[1]);
}
async run() {
this.init();
this.engine.run();
}
}
Beta Was this translation helpful? Give feedback.
All reactions