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

Method updateAttachment

Engine/source/T3D/player.cpp:4754–4788  ·  view source on GitHub ↗

PATHSHAPE This Function does a ray cast down to see if a pathshape object is below If so, it will attempt to attach to it.

Source from the content-addressed store, hash-verified

4752// This Function does a ray cast down to see if a pathshape object is below
4753// If so, it will attempt to attach to it.
4754void Player::updateAttachment(){
4755 Point3F rot, pos;
4756 RayInfo rInfo;
4757 MatrixF mat = getTransform();
4758 mat.getColumn(3, &pos);
4759 if (gServerContainer.castRay(Point3F(pos.x, pos.y, pos.z + 0.1f),
4760 Point3F(pos.x, pos.y, pos.z - 1.0f ),
4761 PathShapeObjectType, &rInfo))
4762 {
4763 if( rInfo.object->getTypeMask() & PathShapeObjectType) //Ramen
4764 {
4765 if (getParent() == NULL)
4766 { // ONLY do this if we are not parented
4767 //Con::printf("I'm on a pathshape object. Going to attempt attachment.");
4768 ShapeBase* col = static_cast<ShapeBase*>(rInfo.object);
4769 if (!isGhost())
4770 {
4771 this->attachToParent(col);
4772 }
4773 }
4774 }
4775 else
4776 {
4777 //Con::printf("object %i",rInfo.object->getId());
4778 }
4779 }
4780 else
4781 {
4782 if (getParent() !=NULL)
4783 {
4784 clearProcessAfter();
4785 attachToParent(NULL);
4786 }
4787 }
4788}
4789// PATHSHAPE END
4790
4791//----------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 5

getColumnMethod · 0.80
getTypeMaskMethod · 0.80
attachToParentMethod · 0.80
Point3FClass · 0.50
castRayMethod · 0.45

Tested by

no test coverage detected