[LayaAir 2.0]Uncaught 无法实例class PhysicsCollider extends PhysicsTriggerComponent
PhysicsCollider这个组件我只添加了一次,当我按住键盘在点击鼠标的时候,就会有这个错误。说我组件重复添加。我不知道,是你们有默认的键盘事件影响的,还是什么问题。
以下是报错信息,这个错误也不是每次都报,多试几次就会有。
Uncaught 无法实例class PhysicsCollider extends PhysicsTriggerComponent {
constructor(collisionGroup = Physics3DUtils.COLLISIONFILTERGROUP_DEFAULTFILTER, canCollideWith = Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER) {
super(collisionGroup, canCollideWith);
this._enableProcessCollisions = false;
}
_addToSimulation() {
this._simulation._addPhysicsCollider(this, this._collisionGroup, this._canCollideWith);
}
_removeFromSimulation() {
this._simulation._removePhysicsCollider(this);
}
_parse(data) {
(data.friction != null) && (this.friction = data.friction);
(data.rollingFriction != null) && (this.rollingFriction = data.rollingFriction);
(data.restitution != null) && (this.restitution = data.restitution);
(data.isTrigger != null) && (this.isTrigger = data.isTrigger);
super._parse(data);
this._parseShape(data.shapes);
}
_onAdded() {
var bt = Physics3D._bullet;
var btColObj = bt.btCollisionObject_create();
bt.btCollisionObject_setUserIndex(btColObj, this.id);
bt.btCollisionObject_forceActivationState(btColObj, PhysicsComponent.ACTIVATIONSTATE_DISABLE_SIMULATION);
var flags = bt.btCollisionObject_getCollisionFlags(btColObj);
if (this.owner.isStatic) {
if ((flags & PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT) > 0)
flags = flags ^ PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT;
flags = flags | PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT;
}
else {
if ((flags & PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT) > 0)
flags = flags ^ PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT;
flags = flags | PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT;
}
bt.btCollisionObject_setCollisionFlags(btColObj, flags);
this._btColliderObject = btColObj;
super._onAdded();
}
}组件,class PhysicsCollider extends PhysicsTriggerComponent {
constructor(collisionGroup = Physics3DUtils.COLLISIONFILTERGROUP_DEFAULTFILTER, canCollideWith = Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER) {
super(collisionGroup, canCollideWith);
this._enableProcessCollisions = false;
}
_addToSimulation() {
this._simulation._addPhysicsCollider(this, this._collisionGroup, this._canCollideWith);
}
_removeFromSimulation() {
this._simulation._removePhysicsCollider(this);
}
_parse(data) {
(data.friction != null) && (this.friction = data.friction);
(data.rollingFriction != null) && (this.rollingFriction = data.rollingFriction);
(data.restitution != null) && (this.restitution = data.restitution);
(data.isTrigger != null) && (this.isTrigger = data.isTrigger);
super._parse(data);
this._parseShape(data.shapes);
}
_onAdded() {
var bt = Physics3D._bullet;
var btColObj = bt.btCollisionObject_create();
bt.btCollisionObject_setUserIndex(btColObj, this.id);
bt.btCollisionObject_forceActivationState(btColObj, PhysicsComponent.ACTIVATIONSTATE_DISABLE_SIMULATION);
var flags = bt.btCollisionObject_getCollisionFlags(btColObj);
if (this.owner.isStatic) {
if ((flags & PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT) > 0)
flags = flags ^ PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT;
flags = flags | PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT;
}
else {
if ((flags & PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT) > 0)
flags = flags ^ PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT;
flags = flags | PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT;
}
bt.btCollisionObject_setCollisionFlags(btColObj, flags);
this._btColliderObject = btColObj;
super._onAdded();
}
}组件已存在!
以下是报错信息,这个错误也不是每次都报,多试几次就会有。
Uncaught 无法实例class PhysicsCollider extends PhysicsTriggerComponent {
constructor(collisionGroup = Physics3DUtils.COLLISIONFILTERGROUP_DEFAULTFILTER, canCollideWith = Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER) {
super(collisionGroup, canCollideWith);
this._enableProcessCollisions = false;
}
_addToSimulation() {
this._simulation._addPhysicsCollider(this, this._collisionGroup, this._canCollideWith);
}
_removeFromSimulation() {
this._simulation._removePhysicsCollider(this);
}
_parse(data) {
(data.friction != null) && (this.friction = data.friction);
(data.rollingFriction != null) && (this.rollingFriction = data.rollingFriction);
(data.restitution != null) && (this.restitution = data.restitution);
(data.isTrigger != null) && (this.isTrigger = data.isTrigger);
super._parse(data);
this._parseShape(data.shapes);
}
_onAdded() {
var bt = Physics3D._bullet;
var btColObj = bt.btCollisionObject_create();
bt.btCollisionObject_setUserIndex(btColObj, this.id);
bt.btCollisionObject_forceActivationState(btColObj, PhysicsComponent.ACTIVATIONSTATE_DISABLE_SIMULATION);
var flags = bt.btCollisionObject_getCollisionFlags(btColObj);
if (this.owner.isStatic) {
if ((flags & PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT) > 0)
flags = flags ^ PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT;
flags = flags | PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT;
}
else {
if ((flags & PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT) > 0)
flags = flags ^ PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT;
flags = flags | PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT;
}
bt.btCollisionObject_setCollisionFlags(btColObj, flags);
this._btColliderObject = btColObj;
super._onAdded();
}
}组件,class PhysicsCollider extends PhysicsTriggerComponent {
constructor(collisionGroup = Physics3DUtils.COLLISIONFILTERGROUP_DEFAULTFILTER, canCollideWith = Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER) {
super(collisionGroup, canCollideWith);
this._enableProcessCollisions = false;
}
_addToSimulation() {
this._simulation._addPhysicsCollider(this, this._collisionGroup, this._canCollideWith);
}
_removeFromSimulation() {
this._simulation._removePhysicsCollider(this);
}
_parse(data) {
(data.friction != null) && (this.friction = data.friction);
(data.rollingFriction != null) && (this.rollingFriction = data.rollingFriction);
(data.restitution != null) && (this.restitution = data.restitution);
(data.isTrigger != null) && (this.isTrigger = data.isTrigger);
super._parse(data);
this._parseShape(data.shapes);
}
_onAdded() {
var bt = Physics3D._bullet;
var btColObj = bt.btCollisionObject_create();
bt.btCollisionObject_setUserIndex(btColObj, this.id);
bt.btCollisionObject_forceActivationState(btColObj, PhysicsComponent.ACTIVATIONSTATE_DISABLE_SIMULATION);
var flags = bt.btCollisionObject_getCollisionFlags(btColObj);
if (this.owner.isStatic) {
if ((flags & PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT) > 0)
flags = flags ^ PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT;
flags = flags | PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT;
}
else {
if ((flags & PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT) > 0)
flags = flags ^ PhysicsComponent.COLLISIONFLAGS_STATIC_OBJECT;
flags = flags | PhysicsComponent.COLLISIONFLAGS_KINEMATIC_OBJECT;
}
bt.btCollisionObject_setCollisionFlags(btColObj, flags);
this._btColliderObject = btColObj;
super._onAdded();
}
}组件已存在!
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
煮饭烫伤手
赞同来自:
我想知道,为什么这里没有关闭Scene,而我的页面仍然被隐藏了呢。