void GUIWidget::_updateTransform(const HSceneObject& parent) { // If the widgets parent scene object moved, we need to mark it as dirty // as the GUIManager batching relies on object positions, so it needs to be updated. const float diffEpsilon = 0.0001f; Vector3 position = parent->getWorldPosition(); Quaternion rotation = parent->getWorldRotation(); Vector3 scale = parent->getWorldScale(); if(!mWidgetIsDirty) { if(!Math::approxEquals(mPosition, position, diffEpsilon)) mWidgetIsDirty = true; else { if(!Math::approxEquals(mRotation, rotation, diffEpsilon)) mWidgetIsDirty = true; else { if(Math::approxEquals(mScale, scale)) mWidgetIsDirty = true; } } } mPosition = position; mRotation = rotation; mScale = scale; mTransform = parent->getWorldTfrm(); }
PhysXRigidbody::PhysXRigidbody(PxPhysics* physx, PxScene* scene, const HSceneObject& linkedSO) :Rigidbody(linkedSO) { PxTransform tfrm = toPxTransform(linkedSO->getWorldPosition(), linkedSO->getWorldRotation()); mInternal = physx->createRigidDynamic(tfrm); mInternal->userData = this; scene->addActor(*mInternal); }
void Light::_updateTransform(const HSceneObject& parent) { UINT32 curHash = parent->getTransformHash(); if (curHash != _getLastModifiedHash()) { setPosition(parent->getWorldPosition()); setRotation(parent->getWorldRotation()); _setLastModifiedHash(curHash); } }