Getting Local Translation of Entity always returns 0, 0, 0

Hi all,

I’m sure I’m just missing something simple here but when trying to get the Local Translation of an Entity in C++, the result is always a Vector3 of zeroes and I need a fresh pair of eyes to help. Any assistance is appreciated.

Here’s relevant code

#include <AzCore/Component/TransformBus.h>
// org is initialised as AZ::Vector3::CreateOnes();
AZ::TransformBus::EventResult(org, GetEntityId(), &AZ::TransformBus::Events::GetLocalTranslation);

AZ_Printf("TPSC", "Entity at %f, %f, %f", org.GetX(), org.GetY(), org.GetZ());

hi, try to use static_cast< float > or (float)(FloatValueType)

AZ_Printf("Vegetation::StaticVegetationData", "position %f %f %f", static_cast<float>(svd.m_position.GetX()), static_cast<float>(svd.m_position.GetY()), static_cast<float>(svd.m_position.GetZ()));

1 Like