MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _updateCollision

Method _updateCollision

Engine/source/T3D/convexShape.cpp:1524–1560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1522}
1523
1524void ConvexShape::_updateCollision()
1525{
1526 SAFE_DELETE( mPhysicsRep );
1527
1528 if ( !PHYSICSMGR )
1529 return;
1530
1531 PhysicsCollision *colShape = PHYSICSMGR->createCollision();
1532
1533 // We need the points untransformed!
1534 Vector<Point3F> rawPoints;
1535 MatrixF xfm( getWorldTransform() );
1536 xfm.setPosition( Point3F::Zero );
1537 for ( U32 i=0; i < mGeometry.points.size(); i++ )
1538 {
1539 Point3F p = mGeometry.points[i];
1540 xfm.mulP( p );
1541 rawPoints.push_back( p );
1542 }
1543
1544 // The convex generation from a point cloud
1545 // can fail at times... give up in that case.
1546 if ( !colShape->addConvex( mGeometry.points.address(),
1547 mGeometry.points.size(),
1548 MatrixF::Identity ) )
1549 {
1550 delete colShape;
1551 return;
1552 }
1553
1554 PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" );
1555
1556 mPhysicsRep = PHYSICSMGR->createBody();
1557 mPhysicsRep->init( colShape, 0, 0, this, world );
1558
1559 mPhysicsRep->setTransform( getTransform() );
1560}
1561
1562void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *mat )
1563{

Callers

nothing calls this directly

Calls 12

getWorldTransformFunction · 0.85
mulPMethod · 0.80
createCollisionMethod · 0.45
setPositionMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
addConvexMethod · 0.45
addressMethod · 0.45
getWorldMethod · 0.45
createBodyMethod · 0.45
initMethod · 0.45
setTransformMethod · 0.45

Tested by

no test coverage detected