[LayaAirIDE3]3.2 版本的PhysicsSimulation的shapeCast方法没有了

以前版本的PhysicsSimulation的shapeCast方法在3.2里面已经没有shapeCast了,而且文档上面还有。
1想问下后续会不会补上这个方法,以及什么版本会有。
2我们把原来的方法copy过来,发现执行跟2.0的物理执行结果不一致,想问下是哪有问题。代码如下
 let bt = Laya.btPhysicsCreateUtil["_bt"];
PoolPhysics._btTempVector30 = bt.btVector3_create(0, 0, 0);
PoolPhysics._btTempVector31= bt.btVector3_create(0, 0, 0);
PoolPhysics._btTempQuaternion0= bt.btQuaternion_create(0, 0, 0, 1);
PoolPhysics._btTempQuaternion1= bt.btQuaternion_create(0, 0, 0, 1);
PoolPhysics._btTempTransform0= bt.btTransform_create();
PoolPhysics._btTempTransform1= bt.btTransform_create();

physics._simulation.shapeCast=function(shape, fromPosition, toPosition, out = null, fromRotation = null, toRotation = null, collisonGroup = Laya.Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER, collisionMask = Laya.Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER, allowedCcdPenetration = 0.0) {

var bt = this._bt;
var convexResultCall = this._btClosestConvexResultCallback;
var convexPosFrom = PoolPhysics._btTempVector30;
var convexPosTo = PoolPhysics._btTempVector31;
var convexRotFrom = PoolPhysics._btTempQuaternion0;
var convexRotTo = PoolPhysics._btTempQuaternion1;
var convexTransform = PoolPhysics._btTempTransform0;
var convexTransTo = PoolPhysics._btTempTransform1;
var sweepShape = shape._shape._btShape;
bt.btVector3_setValue(convexPosFrom, -fromPosition.x, fromPosition.y, fromPosition.z);
bt.btVector3_setValue(convexPosTo, -toPosition.x, toPosition.y, toPosition.z);
bt.ConvexResultCallback_set_m_collisionFilterGroup(convexResultCall, collisonGroup);
bt.ConvexResultCallback_set_m_collisionFilterMask(convexResultCall, collisionMask);
bt.btTransform_setOrigin(convexTransform, convexPosFrom);
bt.btTransform_setOrigin(convexTransTo, convexPosTo);
if (fromRotation) {
bt.btQuaternion_setValue(convexRotFrom, -fromRotation.x, fromRotation.y, fromRotation.z, -fromRotation.w);
bt.btTransform_setRotation(convexTransform, convexRotFrom);
}
else {
bt.btTransform_setRotation(convexTransform, this._btDefaultQuaternion);
}
if (toRotation) {
bt.btQuaternion_setValue(convexRotTo, -toRotation.x, toRotation.y, toRotation.z, -toRotation.w);
bt.btTransform_setRotation(convexTransTo, convexRotTo);
}
else {
bt.btTransform_setRotation(convexTransTo, this._btDefaultQuaternion);
}
bt.ClosestConvexResultCallback_set_m_hitCollisionObject(convexResultCall, null);
bt.ConvexResultCallback_set_m_closestHitFraction(convexResultCall, 1);
bt.btCollisionWorld_convexSweepTest(this._btCollisionWorld, sweepShape, convexTransform, convexTransTo, convexResultCall, allowedCcdPenetration);
if (bt.ConvexResultCallback_hasHit(convexResultCall)) {
if (out) {
let _physicObjectsMap = Laya.btCollider["_physicObjectsMap"]
out.succeeded = true;
out.collider = _physicObjectsMap[bt.btCollisionObject_getUserIndex(bt.ClosestConvexResultCallback_get_m_hitCollisionObject(convexResultCall))];
out.hitFraction = bt.ConvexResultCallback_get_m_closestHitFraction(convexResultCall);
var btPoint = bt.ClosestConvexResultCallback_get_m_hitPointWorld(convexResultCall);
var btNormal = bt.ClosestConvexResultCallback_get_m_hitNormalWorld(convexResultCall);
var point = out.point;
var normal = out.normal;
point.x = -bt.btVector3_x(btPoint);
point.y = bt.btVector3_y(btPoint);
point.z = bt.btVector3_z(btPoint);
normal.x = -bt.btVector3_x(btNormal);
normal.y = bt.btVector3_y(btNormal);
normal.z = bt.btVector3_z(btNormal);
}
return true;
}
else {
if (out)
out.succeeded = false;
return false;
}
}
已邀请:

layaAir小孟

赞同来自:

您好,非常抱歉文档没有及时更新给您带来的不便。目前3.2中已经删除了shapeCast,相关的替代还在做~

要回复问题请先

商务合作
商务合作