Merge pull request #855 from aws-lumberyard-dev/non-uniform-scale-blast
remove vector scale from Blast in preparation for its removal from Transform
This commit is contained in:
+11
-2
@@ -30,6 +30,16 @@ namespace AzPhysics
|
||||
classElement.AddElementWithData(context, "name", name);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimulatedBodyVersionConverter([[maybe_unused]] AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
|
||||
{
|
||||
if (classElement.GetVersion() <= 1)
|
||||
{
|
||||
classElement.RemoveElementByName(AZ_CRC_CE("scale"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
AZ_CLASS_ALLOCATOR_IMPL(SimulatedBodyConfiguration, AZ::SystemAllocator, 0);
|
||||
@@ -40,11 +50,10 @@ namespace AzPhysics
|
||||
{
|
||||
serializeContext->ClassDeprecate("WorldBodyConfiguration", "{6EEB377C-DC60-4E10-AF12-9626C0763B2D}", &Internal::DeprecateWorldBodyConfiguration);
|
||||
serializeContext->Class<SimulatedBodyConfiguration>()
|
||||
->Version(1)
|
||||
->Version(2, &Internal::SimulatedBodyVersionConverter)
|
||||
->Field("name", &SimulatedBodyConfiguration::m_debugName)
|
||||
->Field("position", &SimulatedBodyConfiguration::m_position)
|
||||
->Field("orientation", &SimulatedBodyConfiguration::m_orientation)
|
||||
->Field("scale", &SimulatedBodyConfiguration::m_scale)
|
||||
->Field("entityId", &SimulatedBodyConfiguration::m_entityId)
|
||||
->Field("startSimulationEnabled", &SimulatedBodyConfiguration::m_startSimulationEnabled)
|
||||
;
|
||||
|
||||
-1
@@ -38,7 +38,6 @@ namespace AzPhysics
|
||||
// Basic initial settings.
|
||||
AZ::Vector3 m_position = AZ::Vector3::CreateZero();
|
||||
AZ::Quaternion m_orientation = AZ::Quaternion::CreateIdentity();
|
||||
AZ::Vector3 m_scale = AZ::Vector3::CreateOne();
|
||||
bool m_startSimulationEnabled = true;
|
||||
|
||||
// Entity/object association.
|
||||
|
||||
@@ -32,10 +32,11 @@ namespace Blast
|
||||
Physics::MaterialId m_physicsMaterialId;
|
||||
AZ::Vector3 m_parentLinearVelocity = AZ::Vector3::CreateZero();
|
||||
AZ::Vector3 m_parentCenterOfMass = AZ::Vector3::CreateZero();
|
||||
AzPhysics::RigidBodyConfiguration m_bodyConfiguration; //! Either rigid dynamic or rigid static
|
||||
AZStd::vector<uint32_t> m_chunkIndices; //! Chunks that are going to simulate this actor.
|
||||
AZStd::shared_ptr<AZ::Entity> m_entity; //! Entity that the actor should use to simulate rigid body
|
||||
bool m_isStatic = false; //! Denotes whether actor should be simulated by a static or dynamic rigid body.
|
||||
bool m_isLeafChunk = false; //! Denotes whether this actor represented by a single leaf chunk.
|
||||
AzPhysics::RigidBodyConfiguration m_bodyConfiguration; //!< Either rigid dynamic or rigid static
|
||||
AZStd::vector<uint32_t> m_chunkIndices; //!< Chunks that are going to simulate this actor.
|
||||
AZStd::shared_ptr<AZ::Entity> m_entity; //!< Entity that the actor should use to simulate rigid body
|
||||
bool m_isStatic = false; //!< Denotes whether actor should be simulated by a static or dynamic rigid body.
|
||||
bool m_isLeafChunk = false; //!< Denotes whether this actor represented by a single leaf chunk.
|
||||
float m_scale = 1.0f; //!< Uniform scale applied to the actor.
|
||||
};
|
||||
} // namespace Blast
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Blast
|
||||
, m_parentLinearVelocity(desc.m_parentLinearVelocity)
|
||||
, m_parentCenterOfMass(desc.m_parentCenterOfMass)
|
||||
, m_bodyConfiguration(desc.m_bodyConfiguration)
|
||||
, m_scale(desc.m_scale)
|
||||
{
|
||||
// Store pointer to ourselves in the blast toolkit actor's userData
|
||||
m_tkActor.userData = this;
|
||||
@@ -67,7 +68,7 @@ namespace Blast
|
||||
|
||||
auto transform = AZ::Transform::CreateFromQuaternionAndTranslation(
|
||||
m_bodyConfiguration.m_orientation, m_bodyConfiguration.m_position);
|
||||
transform.MultiplyByScale(m_bodyConfiguration.m_scale);
|
||||
transform.MultiplyByScale(AZ::Vector3(m_scale));
|
||||
|
||||
AZ::TransformBus::Event(m_entity->GetId(), &AZ::TransformInterface::SetWorldTM, transform);
|
||||
|
||||
@@ -130,7 +131,7 @@ namespace Blast
|
||||
Physics::NativeShapeConfiguration shapeConfiguration;
|
||||
shapeConfiguration.m_nativeShapePtr =
|
||||
reinterpret_cast<void*>(const_cast<physx::PxConvexMeshGeometry*>(&subchunk.geometry)->convexMesh);
|
||||
shapeConfiguration.m_nativeShapeScale = m_bodyConfiguration.m_scale;
|
||||
shapeConfiguration.m_nativeShapeScale = AZ::Vector3(m_scale);
|
||||
|
||||
AZStd::shared_ptr<Physics::Shape> shape = AZ::Interface<Physics::SystemRequests>::Get()->CreateShape(
|
||||
colliderConfiguration, shapeConfiguration);
|
||||
|
||||
@@ -77,5 +77,6 @@ namespace Blast
|
||||
AZ::Vector3 m_parentLinearVelocity = AZ::Vector3::CreateZero();
|
||||
AZ::Vector3 m_parentCenterOfMass = AZ::Vector3::CreateZero();
|
||||
AzPhysics::RigidBodyConfiguration m_bodyConfiguration;
|
||||
float m_scale = 1.0f;
|
||||
};
|
||||
} // namespace Blast
|
||||
|
||||
@@ -147,6 +147,7 @@ namespace Blast
|
||||
void BlastFamilyComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC("BlastFamilyService"));
|
||||
incompatible.push_back(AZ_CRC_CE("NonUniformScaleService"));
|
||||
}
|
||||
|
||||
void BlastFamilyComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace Blast
|
||||
void EditorBlastFamilyComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC_CE("BlastFamilyService"));
|
||||
incompatible.push_back(AZ_CRC_CE("NonUniformScaleService"));
|
||||
}
|
||||
|
||||
void EditorBlastFamilyComponent::OnAssetReady(AZ::Data::Asset<AZ::Data::AssetData> asset)
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace Blast
|
||||
AZ::ComponentDescriptor::DependencyArrayType& incompatible)
|
||||
{
|
||||
incompatible.push_back(AZ_CRC("BlastMeshDataService"));
|
||||
incompatible.push_back(AZ_CRC_CE("NonUniformScaleService"));
|
||||
}
|
||||
|
||||
void EditorBlastMeshDataComponent::Reflect(AZ::ReflectContext* context)
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Blast
|
||||
if (parentBody)
|
||||
{
|
||||
parentTransform = parentBody->GetTransform();
|
||||
parentTransform.MultiplyByScale(m_initialTransform.GetScale());
|
||||
parentTransform.MultiplyByScale(AZ::Vector3(m_initialTransform.GetScale().GetMaxElement()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,7 +239,6 @@ namespace Blast
|
||||
AzPhysics::RigidBodyConfiguration configuration;
|
||||
configuration.m_position = transform.GetTranslation();
|
||||
configuration.m_orientation = transform.GetRotation();
|
||||
configuration.m_scale = transform.GetScale();
|
||||
configuration.m_ccdEnabled = m_actorConfiguration.m_isCcdEnabled;
|
||||
configuration.m_startSimulationEnabled = m_actorConfiguration.m_isSimulated;
|
||||
configuration.m_initialAngularVelocity = AZ::Vector3::CreateZero();
|
||||
@@ -255,6 +254,7 @@ namespace Blast
|
||||
actorDesc.m_parentCenterOfMass = transform.GetTranslation();
|
||||
actorDesc.m_parentLinearVelocity = AZ::Vector3::CreateZero();
|
||||
actorDesc.m_bodyConfiguration = configuration;
|
||||
actorDesc.m_scale = transform.GetScale().GetMaxElement();
|
||||
|
||||
return actorDesc;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Blast
|
||||
.Times(1)
|
||||
.WillOnce(Return(false));
|
||||
|
||||
AZ::Transform transform = AZ::Transform::CreateScale(AZ::Vector3::CreateOne());
|
||||
AZ::Transform transform = AZ::Transform::CreateIdentity();
|
||||
blastFamily->Spawn(transform);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user