fix: correct throw trajectory for throwable
This commit is contained in:
parent
2b6bdf9f80
commit
c4320db5e0
|
|
@ -77,7 +77,7 @@ AActor* UShootingComponent::ExecuteLineTrace(float LineRange)
|
|||
|
||||
// DEBUG
|
||||
if (bShowDebugLine)
|
||||
DrawDebugLine(GetWorld(), ViewLocation, EndVector, FColor::Red, false, 1.0f, 0, 1.0f);
|
||||
DrawDebugLine(GetWorld(), ViewLocation, EndVector, FColor::Red, false, 5.0f, 0, 1.0f);
|
||||
|
||||
if (GetWorld()->LineTraceSingleByChannel(Hit, ViewLocation, EndVector, ECC_Visibility, QueryParams) &&
|
||||
IsValid(Hit.GetActor()) && Hit.GetActor()->Implements<UDamageable>())
|
||||
|
|
@ -264,12 +264,11 @@ void UShootingComponent::StopAiming()
|
|||
TargetFOV = DefaultFOV;
|
||||
}
|
||||
|
||||
void UShootingComponent::Throw() // Wymaga dopracowania
|
||||
void UShootingComponent::Throw()
|
||||
{
|
||||
if (IsValid(ThrowableItem))
|
||||
{
|
||||
FVector ForwardVector = PlayerCharacter->GetActorForwardVector();
|
||||
FVector DroppedPos = PlayerCharacter->GetActorLocation() + (ForwardVector * 100.f);
|
||||
FVector DroppedPos = CameraManager->GetCameraLocation() + CameraManager->GetActorForwardVector() * 100.f;
|
||||
|
||||
FTransform DroppedTransform = PlayerCharacter->GetActorTransform();
|
||||
DroppedTransform.SetLocation(DroppedPos);
|
||||
|
|
@ -285,7 +284,7 @@ void UShootingComponent::Throw() // Wymaga dopracowania
|
|||
ThrowedItem->ThrowableType = ThrowableItem->ThrowableType;
|
||||
|
||||
FVector ThrowVector = (ThrowedItem->GetActorLocation() - PlayerCharacter->GetActorLocation()).GetSafeNormal();
|
||||
ThrowedItem->Mesh->SetPhysicsLinearVelocity(ThrowVector * 800.f);
|
||||
ThrowedItem->Mesh->SetPhysicsLinearVelocity(ThrowVector * 1000.f); // Need force to change to the game
|
||||
|
||||
if (ThrowableItem->Quantity <= 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user