Added a target offset for camera arm #264
|
@ -8,6 +8,7 @@ namespace SHADE
|
|||
|
||||
SHCameraArmComponent::SHCameraArmComponent()
|
||||
:pitch(0.0f), yaw(0.0f), armLength(1.0f),offset(), dirty(true), lookAtCameraOrigin(true)
|
||||
, targetOffset(0.0f)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -33,6 +34,11 @@ namespace SHADE
|
|||
return armLength;
|
||||
}
|
||||
|
||||
SHVec3 SHCameraArmComponent::GetTargetOffset() const noexcept
|
||||
{
|
||||
return targetOffset;
|
||||
}
|
||||
|
||||
void SHCameraArmComponent::SetPitch(float pitch) noexcept
|
||||
{
|
||||
this->pitch = pitch;
|
||||
|
@ -51,6 +57,11 @@ namespace SHADE
|
|||
dirty = true;
|
||||
}
|
||||
|
||||
void SHCameraArmComponent::SetTargetOffset(SHVec3 offset) noexcept
|
||||
{
|
||||
this->targetOffset = offset;
|
||||
}
|
||||
|
||||
}//namespace SHADE
|
||||
|
||||
|
||||
|
@ -63,6 +74,8 @@ RTTR_REGISTRATION
|
|||
.property("Arm Pitch", &SHCameraArmComponent::GetPitch, &SHCameraArmComponent::SetPitch)
|
||||
.property("Arm Yaw", &SHCameraArmComponent::GetYaw, &SHCameraArmComponent::SetYaw)
|
||||
.property("Arm Length", &SHCameraArmComponent::GetArmLength, &SHCameraArmComponent::SetArmLength)
|
||||
.property("Look At Camera Origin", &SHCameraArmComponent::lookAtCameraOrigin);
|
||||
.property("Look At Camera Origin", &SHCameraArmComponent::lookAtCameraOrigin)
|
||||
.property("Target Offset", &SHCameraArmComponent::GetTargetOffset, &SHCameraArmComponent::SetTargetOffset)
|
||||
;
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@ namespace SHADE
|
|||
|
||||
bool dirty;
|
||||
SHVec3 offset;
|
||||
|
||||
SHVec3 targetOffset;
|
||||
public:
|
||||
friend class SHCameraSystem;
|
||||
SHCameraArmComponent();
|
||||
|
@ -30,11 +30,13 @@ namespace SHADE
|
|||
float GetPitch() const noexcept;
|
||||
float GetYaw() const noexcept;
|
||||
float GetArmLength() const noexcept;
|
||||
SHVec3 GetTargetOffset() const noexcept;
|
||||
|
||||
//Setters
|
||||
void SetPitch(float pitch) noexcept;
|
||||
void SetYaw(float yaw) noexcept;
|
||||
void SetArmLength(float length) noexcept;
|
||||
void SetTargetOffset(SHVec3 offset)noexcept;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace SHADE
|
|||
{
|
||||
camera.offset = arm->GetOffset();
|
||||
if (arm->lookAtCameraOrigin)
|
||||
CameraLookAt(camera, camera.position);
|
||||
CameraLookAt(camera, camera.position + arm->GetTargetOffset());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,4 +48,15 @@ namespace SHADE
|
|||
{
|
||||
GetNativeComponent()->lookAtCameraOrigin = val;
|
||||
}
|
||||
|
||||
Vector3 CameraArm::TargetOffset::get()
|
||||
{
|
||||
return Convert::ToCLI(GetNativeComponent()->GetTargetOffset());
|
||||
}
|
||||
|
||||
void CameraArm::TargetOffset::set(Vector3 val)
|
||||
{
|
||||
GetNativeComponent()->SetTargetOffset(Convert::ToNative(val));
|
||||
}
|
||||
|
||||
}
|
|
@ -36,5 +36,11 @@ namespace SHADE
|
|||
void set(bool val);
|
||||
}
|
||||
|
||||
property Vector3 TargetOffset
|
||||
{
|
||||
Vector3 get();
|
||||
void set(Vector3 val);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue