开启后也不见好,如果我把旋转的柱子给隐藏了,然后修改圈的重力,当手机倒过来会出现穿墙:
onLoad () {
systemEvent.on(SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
systemEvent.setAccelerometerEnabled(true);
this.rogidBody= this.node.getComponent(RigidBody);
this.rogidBody.useCCD=true;
}
onDeviceMotionEvent (event:any) {
if(this.rogidBody){
this.deltaLinearFactor.x = event.acc.x;
this.deltaLinearFactor.y= -event.acc.y;
this.deltaLinearFactor.z= event.acc.z;
this.rogidBody.linearFactor=this.deltaLinearFactor;
}
}
onDestroy () {
systemEvent.setAccelerometerEnabled(false);
systemEvent.off(SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
}