Camera locking when its transform is locked (#5996)
* Locking the camera when its entity transform is locked Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com> * Added function to unposses camera when transform locks Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com> * Basic camera behaviour Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com> * Addressed codereview suggestions Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com>
This commit is contained in:
@@ -151,7 +151,12 @@ namespace Camera
|
||||
|
||||
void CameraComponentController::SetShouldActivateFunction(AZStd::function<bool()> shouldActivateFunction)
|
||||
{
|
||||
m_shouldActivateFn = shouldActivateFunction;
|
||||
m_shouldActivateFn = AZStd::move(shouldActivateFunction);
|
||||
}
|
||||
|
||||
void CameraComponentController::SetIsLockedFunction(AZStd::function<bool()> isLockedFunction)
|
||||
{
|
||||
m_isLockedFn = AZStd::move(isLockedFunction);
|
||||
}
|
||||
|
||||
void CameraComponentController::Reflect(AZ::ReflectContext* context)
|
||||
@@ -195,10 +200,11 @@ namespace Camera
|
||||
{
|
||||
m_onViewMatrixChanged = AZ::Event<const AZ::Matrix4x4&>::Handler([this](const AZ::Matrix4x4&)
|
||||
{
|
||||
if (!m_updatingTransformFromEntity)
|
||||
if (!m_updatingTransformFromEntity && !m_isLockedFn())
|
||||
{
|
||||
AZ::TransformBus::Event(m_entityId, &AZ::TransformInterface::SetWorldTM, m_atomCamera->GetCameraTransform());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user