【UE4 C++】抛物线路径、发射轨道相关
2021/5/8 12:28:58
本文主要是介绍【UE4 C++】抛物线路径、发射轨道相关,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
基于UGameplayStatics
Blueprint_PredictProjectilePath_ByObjectType
-
根据 Object Type,算出抛物线的点集合和检测结果
static bool Blueprint_PredictProjectilePath_ByObjectType( const UObject* WorldContextObject, FHitResult& OutHit, TArray<FVector>& OutPathPositions, FVector& OutLastTraceDestination, FVector StartPos, FVector LaunchVelocity, bool bTracePath, float ProjectileRadius, const TArray<TEnumAsByte<EObjectTypeQuery> >& ObjectTypes, bool bTraceComplex, const TArray<AActor*>& ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, float DrawDebugTime, float SimFrequency = 15.f, float MaxSimTime = 2.f, float OverrideGravityZ = 0 );
-
代码实现
FVector BeginLoc = GetActorLocation(); FVector LaunchVelocity = GetActorForwardVector() * 1000.0f; TArray<TEnumAsByte<EObjectTypeQuery> > ObjectTypes; ObjectTypes.Add(EObjectTypeQuery::ObjectTypeQuery1); TArray<AActor*> IgnoreActors; FHitResult HitResult; TArray<FVector> OutPatnPositions; FVector OutLastTraceDestination; //开始模拟 bool bIsHit = UGameplayStatics::Blueprint_PredictProjectilePath_ByObjectType( GetWorld(), HitResult, OutPatnPositions, OutLastTraceDestination, BeginLoc, LaunchVelocity, true, 0.0f, ObjectTypes, false, IgnoreActors, EDrawDebugTrace::ForDuration, 0.0f ); if (bIsHit) { UKismetSystemLibrary::PrintString(GetWorld(), HitResult.GetActor()->GetName()); }
Blueprint_PredictProjectilePath_ByTraceChannel
-
根据 ChannelChannel,算出抛物线的点集合和检测结果
static bool Blueprint_PredictProjectilePath_ByTraceChannel( const UObject* WorldContextObject, FHitResult& OutHit, TArray<FVector>& OutPathPositions, FVector& OutLastTraceDestination, FVector StartPos, FVector LaunchVelocity, bool bTracePath, float ProjectileRadius, TEnumAsByte<ECollisionChannel> TraceChannel, bool bTraceComplex, const TArray<AActor*>& ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, float DrawDebugTime, float SimFrequency = 15.f, float MaxSimTime = 2.f, float OverrideGravityZ = 0 );
PredictProjectilePath
-
根据预测参数,推算结果
/** * Predict the arc of a virtual projectile affected by gravity with collision checks along the arc. * Returns true if it hit something. * * @param PredictParams Input params to the trace (start location, velocity, time to simulate, etc). * @param PredictResult Output result of the trace (Hit result, array of location/velocity/times for each trace step, etc). * @return True if hit something along the path (if tracing with collision). */ static bool PredictProjectilePath( const UObject* WorldContextObject, const FPredictProjectilePathParams& PredictParams, FPredictProjectilePathResult& PredictResult );
Blueprint_PredictProjectilePath_Advanced
-
根据预测参数,推算结果
static bool Blueprint_PredictProjectilePath_Advanced( const UObject* WorldContextObject, const FPredictProjectilePathParams& PredictParams, FPredictProjectilePathResult& PredictResult );
BlueprintSuggestProjectileVelocity
-
根据目标点,反算初速度
static bool BlueprintSuggestProjectileVelocity( const UObject* WorldContextObject, FVector& TossVelocity, FVector StartLocation, FVector EndLocation, float LaunchSpeed, float OverrideGravityZ, ESuggestProjVelocityTraceOption::Type TraceOption, float CollisionRadius, bool bFavorHighArc, bool bDrawDebug );
SuggestProjectileVelocity_CustomArc
-
根据目标点,反算初速度
static bool SuggestProjectileVelocity_CustomArc( const UObject* WorldContextObject, FVector& OutLaunchVelocity, FVector StartPos, FVector EndPos, float OverrideGravityZ = 0, float ArcParam = 0.5f );
这篇关于【UE4 C++】抛物线路径、发射轨道相关的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-15在使用平台私钥进行解密时提示 "私钥解密失败" 错误信息是什么原因?-icode9专业技术文章分享
- 2024-11-15Layui框架有哪些方式引入?-icode9专业技术文章分享
- 2024-11-15Layui框架中有哪些减少对全局环境的污染方法?-icode9专业技术文章分享
- 2024-11-15laydate怎么关闭自动的日期格式校验功能?-icode9专业技术文章分享
- 2024-11-15laydate怎么取消初始日期校验?-icode9专业技术文章分享
- 2024-11-15SendGrid 的邮件发送时,怎么设置回复邮箱?-icode9专业技术文章分享
- 2024-11-15使用 SendGrid API 发送邮件后获取到唯一的请求 ID?-icode9专业技术文章分享
- 2024-11-15mailgun 发送邮件 tags标签最多有多少个?-icode9专业技术文章分享
- 2024-11-15mailgun 发送邮件 怎么批量发送给多个人?-icode9专业技术文章分享
- 2024-11-15如何搭建web开发环境并实现 web项目在浏览器中访问?-icode9专业技术文章分享