136*****507
@18523:shapeCastAll(shape, fromPosition, toPosition, out, fromRotation = null, toRotation = null, collisonGroup = Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER, collisionMask = Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER, allowedCcdPenetration = 0.0) {
var bt = ILaya3D.Physics3D._bullet;
var convexResultCall = this._btAllConvexResultCallback;
var convexPosFrom = PhysicsSimulation._btTempVector30;
var convexPosTo = PhysicsSimulation._btTempVector31;
var convexRotFrom = PhysicsSimulation._btTempQuaternion0;
var convexRotTo = PhysicsSimulation._btTempQuaternion1;
var convexTransform = PhysicsSimulation._btTempTransform0;
var convexTransTo = PhysicsSimulation._btTempTransform1;
var sweepShape = shape._btShape;
out.length = 0;
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);
}
var collisionObjects = bt.AllConvexResultCallback_get_m_collisionObjects(convexResultCall);
var btPoints = bt.AllConvexResultCallback_get_m_hitPointWorld(convexResultCall);
var btNormals = bt.AllConvexResultCallback_get_m_hitNormalWorld(convexResultCall);
var btFractions = bt.AllConvexResultCallback_get_m_hitFractions(convexResultCall);
bt.tBtCollisionObjectArray_clear(collisionObjects);
bt.tVector3Array_clear(btPoints);
bt.tVector3Array_clear(btNormals);
bt.tScalarArray_clear(btFractions);
bt.btCollisionWorld_convexSweepTest(this._btCollisionWorld, sweepShape, convexTransform, convexTransTo, convexResultCall, allowedCcdPenetration);
var count = bt.tBtCollisionObjectArray_size(collisionObjects);
if (count > 0) {
this._collisionsUtils.recoverAllHitResultsPool();
for (var i = 0; i < count; i++) {
var hitResult = this._collisionsUtils.getHitResult();
out.push(hitResult);
hitResult.succeeded = true;
hitResult.collider = PhysicsComponent._physicObjectsMap[bt.btCollisionObject_getUserIndex(bt.tBtCollisionObjectArray_at(collisionObjects, i))];
hitResult.hitFraction = bt.tScalarArray_at(btFractions, i);
var btPoint = bt.tVector3Array_at(btPoints, i);
var point = hitResult.point;
point.x = -bt.btVector3_x(btPoint);
point.y = bt.btVector3_y(btPoint);
point.z = bt.btVector3_z(btPoint);
var btNormal = bt.tVector3Array_at(btNormals, i);
var normal = hitResult.normal;
normal.x = -bt.btVector3_x(btNormal);
normal.y = bt.btVector3_y(btNormal);
normal.z = bt.btVector3_z(btNormal);
}
return true;
}
else {
return false;
}
}