-
Creator 版本:
-
目标平台:
-
重现方式:
-
首个报错:
-
之前哪个版本是正常的:
-
手机型号:
-
手机浏览器:
-
编辑器操作系统:
-
重现概率:
最近在做刚体移动,发现刚体移动如果用冲量就会起步慢收手慢,如果直接改变位置又会造成刚体之间的穿透,不知道该怎么办才好
直接设置速度
使用 setLinearVelocity
接口改变线性速度。
使用 setAngularVelocity
接口改变旋转速度。
大佬你这是3D的吧
你是用ammo物理引擎嗎?
ammo的剛體1.2版有一點問題,官方之前有幫我加這幾行在update裡
update(deltaTime: number) {
let rigidBody = this.getComponent(RigidBody);
if (rigidBody.isKinematic) {
const impl = rigidBody.body.impl;
const t = impl’getWorldTransform’;
impl’getMotionState’‘setWorldTransform’;
}
}
該物體剛體IsKinematic、FixedRotation設為true,mass=0,這樣就正常了
可以用linearVelocity
node.getComponent(cc.RigidBody).linearVelocity
1赞
//物理系统默认是关闭的,先打开物理系统
cc.director.getPhysicsManager().enabled = true;
1赞