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

Method _move

Engine/source/T3D/player.cpp:4799–5051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4797}
4798
4799Point3F Player::_move( const F32 travelTime, Collision *outCol )
4800{
4801 // Try and move to new pos
4802 F32 totalMotion = 0.0f;
4803
4804 // TODO: not used?
4805 //F32 initialSpeed = mVelocity.len();
4806
4807 Point3F start;
4808 Point3F initialPosition;
4809 getTransform().getColumn(3,&start);
4810 initialPosition = start;
4811
4812 static CollisionList collisionList;
4813 static CollisionList physZoneCollisionList;
4814
4815 collisionList.clear();
4816 physZoneCollisionList.clear();
4817
4818 MatrixF collisionMatrix(true);
4819 collisionMatrix.setColumn(3, start);
4820
4821 VectorF firstNormal(0.0f, 0.0f, 0.0f);
4822 F32 maxStep = mDataBlock->maxStepHeight;
4823 F32 time = travelTime;
4824 U32 count = 0;
4825
4826 const Point3F& scale = getScale();
4827
4828 static Polyhedron sBoxPolyhedron;
4829 static ExtrudedPolyList sExtrudedPolyList;
4830 static ExtrudedPolyList sPhysZonePolyList;
4831
4832 for (; count < sMoveRetryCount; count++) {
4833 F32 speed = mVelocity.len();
4834 if (!speed && !mDeath.haveVelocity())
4835 break;
4836
4837 Point3F end = start + mVelocity * time;
4838 if (mDeath.haveVelocity()) {
4839 // Add in death movement-
4840 VectorF deathVel = mDeath.getPosAdd();
4841 VectorF resVel;
4842 getTransform().mulV(deathVel, & resVel);
4843 end += resVel;
4844 }
4845 Point3F distance = end - start;
4846
4847 if (mFabs(distance.x) < mScaledBox.len_x() &&
4848 mFabs(distance.y) < mScaledBox.len_y() &&
4849 mFabs(distance.z) < mScaledBox.len_z())
4850 {
4851 // We can potentially early out of this. If there are no polys in the clipped polylist at our
4852 // end position, then we can bail, and just set start = end;
4853 Box3F wBox = mScaledBox;
4854 wBox.minExtents += end;
4855 wBox.maxExtents += end;
4856

Callers

nothing calls this directly

Calls 15

mFabsFunction · 0.85
getColumnMethod · 0.80
setColumnMethod · 0.80
haveVelocityMethod · 0.80
getPosAddMethod · 0.80
mulVMethod · 0.80
getTypeMaskMethod · 0.80
setCollisionListMethod · 0.80
getVelocityModMethod · 0.80
isOverlappedMethod · 0.60
Point3FClass · 0.50
mDotFunction · 0.50

Tested by

no test coverage detected