1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Added ray shape and move_and_slide with snapping on 3D.

Added stop_on_slope on 2d part
This commit is contained in:
Andrea Catania
2018-08-14 19:20:48 +02:00
parent 9826456f2e
commit 0010d9c82a
11 changed files with 338 additions and 75 deletions

View File

@@ -260,10 +260,19 @@ void GodotDeepPenetrationContactResultCallback::addContactPoint(const btVector3
if (m_penetration_distance > depth) { // Has penetration?
bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject();
const bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject();
m_penetration_distance = depth;
m_other_compound_shape_index = isSwapped ? m_index0 : m_index1;
m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld;
m_pointWorld = isSwapped ? (pointInWorldOnB + (normalOnBInWorld * depth)) : pointInWorldOnB;
const btCollisionObjectWrapper *bw0 = m_body0Wrap;
if (isSwapped)
bw0 = m_body1Wrap;
if (bw0->getCollisionShape()->getShapeType() == CUSTOM_CONVEX_SHAPE_TYPE) {
m_pointNormalWorld = bw0->m_worldTransform.getBasis().transpose() * btVector3(0, 0, 1);
} else {
m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld;
}
}
}