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

Method getEyeTransform

Engine/source/T3D/player.cpp:5566–5604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5564}
5565
5566void Player::getEyeTransform(MatrixF* mat)
5567{
5568 getEyeBaseTransform(mat, true);
5569
5570 // The shape instance is animated in getEyeBaseTransform() so we're
5571 // good here when attempting to get the eye node position on the server.
5572 S32 imageIndex = -1;
5573 S32 shapeIndex = -1;
5574 MountedImage* image = NULL;
5575 ShapeBaseImageData* data = NULL;
5576 for (U32 i=0; i<ShapeBase::MaxMountedImages; ++i)
5577 {
5578 image = &(mMountedImageList[i]);
5579 if (image->dataBlock)
5580 {
5581 data = image->dataBlock;
5582 shapeIndex = getImageShapeIndex(*image);
5583 if ( data->useEyeNode && (data->animateOnServer || isGhost()) && isFirstPerson() && data->eyeMountNode[shapeIndex] != -1 && data->eyeNode[shapeIndex] != -1 )
5584 {
5585 imageIndex = i;
5586 break;
5587 }
5588 }
5589 }
5590
5591 if (imageIndex >= 0)
5592 {
5593 // Get the image's eye node's position relative to the eye mount node
5594 MatrixF mountTransform = image->shapeInstance[shapeIndex]->mNodeTransforms[data->eyeMountNode[shapeIndex]];
5595 Point3F eyeMountNodePos = mountTransform.getPosition();
5596 mountTransform = image->shapeInstance[shapeIndex]->mNodeTransforms[data->eyeNode[shapeIndex]];
5597 Point3F eyeNodePos = mountTransform.getPosition() - eyeMountNodePos;
5598
5599 // Now transform to the image's eye node (position only)
5600 MatrixF xfm(true);
5601 xfm.setPosition(eyeNodePos);
5602 mat->mul(xfm);
5603 }
5604}
5605
5606void Player::getEyeBaseTransform(MatrixF* mat, bool includeBank)
5607{

Callers 1

processTickMethod · 0.45

Calls 3

getPositionMethod · 0.45
setPositionMethod · 0.45
mulMethod · 0.45

Tested by

no test coverage detected