WIP - Configure Episode Series Launch

This commit is contained in:
Jb win
2025-05-03 01:45:06 +07:00
parent 19d36fdf00
commit 45490051cd
9 changed files with 173 additions and 24 deletions

View File

@ -23,6 +23,17 @@ void URobotPilotSO100Component::TickComponent(float DeltaTime, enum ELevelTick T
// UE_LOG(LogTemp, Log, TEXT("Joint: %f - Control: %f - Delta: %f"), Joints.Jaw, Controls.Jaw, Controls.Jaw - Joints.Jaw);
}
FTransform URobotPilotSO100Component::GetReachableTransform()
{
const auto RobotTransform = RobotOwner->GetActorTransform();
const float Yaw = MaxYaw * FMath::RandRange(0., 1.) * (FMath::RandBool() ? 1 : -1);
const float Range = MaxRange * FMath::RandRange(0., 1.);
const FRotator RandomRotator = FRotator{0,0,Yaw};
const FVector RandomLocation = RandomRotator.RotateVector(RobotTransform.GetRotation().GetForwardVector() * Range);
const FRotator RandomRotation = UKismetMathLibrary::MakeRotFromXZ(RandomLocation- RobotTransform.GetLocation(), FVector::UpVector);
return FTransform(RandomRotation, RandomLocation);
}
void URobotPilotSO100Component::SetTarget(const FTransform& TargetTransformIn)
{
@ -221,7 +232,7 @@ void URobotPilotSO100Component::MoveToTarget()
const auto JawPositionWorld = RotationToTarget.RotateVector(JawOffsetToPivot) + PivotWorldLocation;
const auto Distance = FVector::Distance(JawPositionWorld, TargetTransform.GetLocation());
const auto AlphaExtend = FMath::Clamp(Distance / MaxReach, 0., 1.);
const auto AlphaExtend = FMath::Clamp(Distance / MaxRange, 0., 1.);
// Set the target actuators values
AnimTargetRobotActuators = GetCurrentJointsFromPhysicsScene();