Skip to content

微信小程序ar环境下,OrbitControls无法使用并且会导致帧数下降 #41

@632366134

Description

@632366134

import { OrbitControls } from "three-platformize/examples/jsm/controls/OrbitControls";
this.camera =new THREE.PerspectiveCamera(20, this.canvas.width / this.canvas.height, 1, 10000);
const renderer = (this.renderer = new THREE.WebGL1Renderer({
antialias: true,
alpha: true,
canvas: this.canvas,
}));
this.orbitControl = new OrbitControls(this.camera, renderer.domElement);
this.orbitControl.enableDamping = true;
this.orbitControl.dampingFactor = 0.05;

const onFrame = (timestamp) => {
// let start = Date.now()
const frame = session.getVKFrame(canvas.width, canvas.height);
if (frame) {
this.render(frame);
}
this.orbitControl?.update()
session.requestAnimationFrame(onFrame);
};
session.requestAnimationFrame(onFrame);

canvas绑定事件
onTX(e) {
this.platform.dispatchTouchEvent(e);
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions