Added a targetOffset for camera arm
This commit is contained in:
parent
f896b4a6e0
commit
49b475442f
|
@ -8,6 +8,7 @@ namespace SHADE
|
||||||
|
|
||||||
SHCameraArmComponent::SHCameraArmComponent()
|
SHCameraArmComponent::SHCameraArmComponent()
|
||||||
:pitch(0.0f), yaw(0.0f), armLength(1.0f),offset(), dirty(true), lookAtCameraOrigin(true)
|
: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;
|
return armLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHVec3 SHCameraArmComponent::GetTargetOffset() const noexcept
|
||||||
|
{
|
||||||
|
return targetOffset;
|
||||||
|
}
|
||||||
|
|
||||||
void SHCameraArmComponent::SetPitch(float pitch) noexcept
|
void SHCameraArmComponent::SetPitch(float pitch) noexcept
|
||||||
{
|
{
|
||||||
this->pitch = pitch;
|
this->pitch = pitch;
|
||||||
|
@ -51,6 +57,11 @@ namespace SHADE
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SHCameraArmComponent::SetTargetOffset(SHVec3 offset) noexcept
|
||||||
|
{
|
||||||
|
this->targetOffset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
}//namespace SHADE
|
}//namespace SHADE
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,6 +74,8 @@ RTTR_REGISTRATION
|
||||||
.property("Arm Pitch", &SHCameraArmComponent::GetPitch, &SHCameraArmComponent::SetPitch)
|
.property("Arm Pitch", &SHCameraArmComponent::GetPitch, &SHCameraArmComponent::SetPitch)
|
||||||
.property("Arm Yaw", &SHCameraArmComponent::GetYaw, &SHCameraArmComponent::SetYaw)
|
.property("Arm Yaw", &SHCameraArmComponent::GetYaw, &SHCameraArmComponent::SetYaw)
|
||||||
.property("Arm Length", &SHCameraArmComponent::GetArmLength, &SHCameraArmComponent::SetArmLength)
|
.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;
|
bool dirty;
|
||||||
SHVec3 offset;
|
SHVec3 offset;
|
||||||
|
SHVec3 targetOffset;
|
||||||
public:
|
public:
|
||||||
friend class SHCameraSystem;
|
friend class SHCameraSystem;
|
||||||
SHCameraArmComponent();
|
SHCameraArmComponent();
|
||||||
|
@ -30,11 +30,13 @@ namespace SHADE
|
||||||
float GetPitch() const noexcept;
|
float GetPitch() const noexcept;
|
||||||
float GetYaw() const noexcept;
|
float GetYaw() const noexcept;
|
||||||
float GetArmLength() const noexcept;
|
float GetArmLength() const noexcept;
|
||||||
|
SHVec3 GetTargetOffset() const noexcept;
|
||||||
|
|
||||||
//Setters
|
//Setters
|
||||||
void SetPitch(float pitch) noexcept;
|
void SetPitch(float pitch) noexcept;
|
||||||
void SetYaw(float yaw) noexcept;
|
void SetYaw(float yaw) noexcept;
|
||||||
void SetArmLength(float length) noexcept;
|
void SetArmLength(float length) noexcept;
|
||||||
|
void SetTargetOffset(SHVec3 offset)noexcept;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
camera.offset = arm->GetOffset();
|
camera.offset = arm->GetOffset();
|
||||||
if (arm->lookAtCameraOrigin)
|
if (arm->lookAtCameraOrigin)
|
||||||
CameraLookAt(camera, camera.position);
|
CameraLookAt(camera, camera.position + arm->GetTargetOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,4 +48,15 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
GetNativeComponent()->lookAtCameraOrigin = val;
|
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);
|
void set(bool val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property Vector3 TargetOffset
|
||||||
|
{
|
||||||
|
Vector3 get();
|
||||||
|
void set(Vector3 val);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue