MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / setTransform

Method setTransform

Engine/source/T3D/entity.cpp:675–743  ·  view source on GitHub ↗

Manipulation

Source from the content-addressed store, hash-verified

673
674//Manipulation
675void Entity::setTransform(const MatrixF &mat)
676{
677 //setMaskBits(TransformMask);
678 setMaskBits(TransformMask | NoWarpMask);
679
680 if (isMounted())
681 {
682 // Use transform from mounted object
683 Point3F newPos = mat.getPosition();
684 Point3F parentPos = mMount.object->getTransform().getPosition();
685
686 Point3F newOffset = newPos - parentPos;
687
688 if (!newOffset.isZero())
689 {
690 //setMountOffset(newOffset);
691 mPos = newOffset;
692 }
693
694 Point3F matEul = mat.toEuler();
695
696 //mRot = Point3F(mRadToDeg(matEul.x), mRadToDeg(matEul.y), mRadToDeg(matEul.z));
697
698 if (matEul != Point3F(0, 0, 0))
699 {
700 Point3F mountEul = mMount.object->getTransform().toEuler();
701 Point3F diff = matEul - mountEul;
702
703 //setMountRotation(Point3F(mRadToDeg(diff.x), mRadToDeg(diff.y), mRadToDeg(diff.z)));
704 mRot = diff;
705 }
706 else
707 {
708 //setMountRotation(Point3F(0, 0, 0));
709 mRot = Point3F(0, 0, 0);
710 }
711
712 RotationF addRot = mRot + RotationF(mMount.object->getTransform());
713 MatrixF transf = addRot.asMatrixF();
714 transf.setPosition(mPos + mMount.object->getPosition());
715
716 Parent::setTransform(transf);
717 }
718 else
719 {
720 //Are we part of a prefab?
721 /*Prefab* p = Prefab::getPrefabByChild(this);
722 if (p)
723 {
724 //just let our prefab know we moved
725 p->childTransformUpdated(this, mat);
726 }*/
727 //else
728 {
729 //mRot.set(mat);
730 //Parent::setTransform(mat);
731
732 RotationF rot = RotationF(mat);

Callers 2

_setPositionMethod · 0.45
_setRotationMethod · 0.45

Calls 12

toEulerMethod · 0.80
asMatrixFMethod · 0.80
asEulerFMethod · 0.80
getColumnMethod · 0.80
setColumnMethod · 0.80
Point3FClass · 0.50
RotationFClass · 0.50
getPositionMethod · 0.45
getTransformMethod · 0.45
isZeroMethod · 0.45
setPositionMethod · 0.45
triggerMethod · 0.45

Tested by

no test coverage detected