Update character bounding box in LY

How do you modify the bounding box of a character asset after it’s been imported into LY? I’ve looked everywhere for this but I only see options to display the bounding box, nothing that actually modifies it.


Hi! if you want to change the CharacterController’s capsule size you could try to use SetHeight, or Resize

	else if (channelId == AzFramework::InputDeviceKeyboard::Key::AlphanumericC)
		static float defaultHeight = 0.0f;

		if (state == AzFramework::InputChannel::State::Began)
			// save original Height
			// #include <..\..\..\Gems\PhysXCharacters\Code\Include\PhysXCharacters\CharacterControllerBus.h>
			PhysXCharacters::CharacterControllerRequestBus::BroadcastResult(defaultHeight, &PhysXCharacters::CharacterControllerRequestBus::Events::GetHeight);

			PhysXCharacters::CharacterControllerRequestBus::Broadcast(&PhysXCharacters::CharacterControllerRequestBus::Events::SetHeight, 0.95f);
			//PhysXCharacters::CharacterControllerRequestBus::Broadcast(&PhysXCharacters::CharacterControllerRequestBus::Events::Resize, 0.95f);
		else if (state == AzFramework::InputChannel::State::Ended)
			// restore original Height  
			PhysXCharacters::CharacterControllerRequestBus::Broadcast(&PhysXCharacters::CharacterControllerRequestBus::Events::SetHeight, defaultHeight);

difference between SetHeight and Resize you can see on pic here (section “Volume Update”)

Thanks for the response Fluffy.

I’m looking to update the characters bounding box rather than the capsule size. The bounding box isn’t used for physics but for visibility culling. It’s set up automatically during import based on calculated bounds of the character mesh.

I may be wrong but it seems like there should be a way to configure this after it’s been imported.

I’m not sure about aabb that exactly used for culling, but you may try to change this aabb like so

void MyComponent::OnActorInstanceCreated(EMotionFX::ActorInstance * actorInstance)
	using namespace LmbrCentral;
	using namespace EMotionFX;
	using namespace EMotionFX::Integration;

	m_ActorInstance = actorInstance;
	m_Actor =  actorInstance->GetActor();
	if (m_Actor) 
		m_Skeleton = m_Actor->GetSkeleton();
		m_ActorInstance->SetAABB(AABB(AZVec3ToLYVec3(...)), AZVec3ToLYVec3(...))

	EMotionFX::Integration::SimpleMotionComponentRequestBus::Event(GetEntityId(), &EMotionFX::Integration::SimpleMotionComponentRequestBus::Events::SetPlaySpeed, 0.0f);
	//EMotionFX::Integration::SimpleMotionComponentRequestBus::Event(GetEntityId(), &EMotionFX::Integration::SimpleMotionComponentRequestBus::Events::GetPlayTime, 0.5f);
	EMotionFX::Integration::SimpleMotionComponentRequestBus::Event(GetEntityId(), &EMotionFX::Integration::SimpleMotionComponentRequestBus::Events::PlayTime, 0.5f);
	//const char* boneName = nullptr;

	//SkeletalHierarchyRequestBus::BroadcastResult(m_boneCount, &SkeletalHierarchyRequests::GetJointCount);
	//SkeletalHierarchyRequestBus::EventResult(m_boneCount, GetEntityId(), &SkeletalHierarchyRequests::GetJointCount);
	//SkeletalHierarchyRequestBus::EventResult(boneName, GetEntityId(), &SkeletalHierarchyRequests::GetJointNameByIndex, 1);

I made short test

It’s seems that SetAABB works
I also tested the SetStaticAABB but it do not do anything.

so for this I save original AABB on event “OnActorInstanceCreated”

		originalAabb = m_ActorInstance->GetAABB();

exactly after creating the AABB gets volume of local space(pure volume), and on next frames AABB gets world’s space volume, so you need adding the translation to character’s world position to original saved Aabb.

void Animation2BlendComponent::SetAABBScale(float factor)
	using namespace EMotionFX;

	if (m_ActorInstance)

		AZ::Vector3 mid = originalAabb.CalcMiddle() + m_entity->GetTransform()->GetWorldTranslation();
		AZ::Vector3 ext = originalAabb.CalcExtents();
		AZ::Vector3 min = mid - ((ext * factor));
		AZ::Vector3 max = mid + ((ext * factor));

		MCore::AABB newaabb = MCore::AABB(min, max);

minimize and restore character’s aabb on key by calling ebus event

Animation2BlendBus::Broadcast(&Animation2BlendBus::Events::SetAABBScale, 0.1f);
Animation2BlendBus::Broadcast(&Animation2BlendBus::Events::SetAABBScale, 1.0f);

I appreciate your response fluffy. Looks like this is the solution I was looking for. I was hoping to get a solution which wouldn’t require source code changes. I haven’t tried diving into the source code yet.