【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++】抛物线路径、发射轨道相关的更多相关文章
- /etc/profile 路径出错后相关的命令失效解决方式
关于 Linux 的配置文件 /etc/profile 路径出错后相关的命令失效解决方式(如:ls,vi不能用) 今天学习LINUX 下配置jdk 和安装tomcat 通过VI编辑/etc/profi ...
- UE4 Android相对路径转绝对路径方法笔记
在windows端用FPaths::ConvertRelativePathToFull可以将相对路径转成绝对路径. 在Andoird端,就麻烦些.可模仿UE4源码中AndroidFile.Cpp转换相 ...
- 卫星轨道相关笔记SGP4
由卫星历书确定卫星轨道状态向量 卫星历书的表示方法有2种: TLE(Two Line Element),和轨道根数表示方法 由卫星历书计算出卫星轨道状态向量的方法有2种: SGP方法,NORAD的方法 ...
- 11g直接路径读、相关参数、10949事件介绍
转载自刘向兵老师:http://www.askmaclean.com/archives/11g-direct-path-read-10949-_small_table_threshold-_seria ...
- PHP中文件类型 文件属性 路径以及 文件相关的函数
一: 文件类型判断: 1.is_dir() 判断是不是目录 2.is_file() 判断是不是文件 3.is_executable() 判断是不是可执行文件 4.is_readable() 判断是 ...
- .md图片链接转存并替换路径,及相关报错解决方法
最初我想把Typora中.md文件中的web图片链接都下载保存到本地,并且替换.md文本中的路径 说干就干,因为在网上没有找到现成的程序所以自己写了这个程序 思路是循环查找文件夹中的文件,然后yiel ...
- 【UE4 C++】学习笔记汇总
UE4 概念知识 基础概念--文件结构.类型.反射.编译.接口.垃圾回收.序列化[导图] GamePlay架构[导图] 类的继承层级关系[导图] 反射机制 垃圾回收机制/算法 序列化 Actor 的生 ...
- Android 利用二次贝塞尔曲线模仿购物车加入物品抛物线动画
Android 利用二次贝塞尔曲线模仿购物车加入物品抛物线动画 0.首先.先给出一张效果gif图. 1.贝塞尔曲线原理及相关公式參考:http://www.jianshu.com/p/c0d7ad79 ...
- SVG的路径动画效果
使用SVG animateMotion实现的一个动画路径效果,相关代码如下. 在线调试唯一地址:http://www.gbtags.com/gb/debug/c88f4099-5056-4ad7-af ...
随机推荐
- 【SpringMVC】文件上传与下载、拦截器、异常处理器
文件下载 使用ResponseEntity实现下载文件的功能 index.html <!DOCTYPE html> <html lang="en" xmlns:t ...
- elasticsearch支持大table格式数据的搜索
一.问题源起 数据情况 TableMeta, 保存table的元数据,通过fileId关联具体的GridFS文件: id name creator fileId 1 table1 mango f1 2 ...
- noip模拟31
\(\color{white}{\mathbb{峭壁通天,横崖无岸,惊无识之马,断无疆之虹,名之以:悬崖}}\) 一看完题就暴肝 \(t1\),胡了两个贪心,实现了一个,发现都是错的,然后奖金两个小时 ...
- 【第十一篇】- Git Gitee之Spring Cloud直播商城 b2b2c电子商务技术总结
Git Gitee 大家都知道国内访问 Github 速度比较慢,很影响我们的使用. 如果你希望体验到 Git 飞一般的速度,可以使用国内的 Git 托管服务--Gitee(gitee.com). G ...
- golang 注释 exported function xxx should have comment or be unexported
0x00 问题 exported function xxx should have comment or be unexported. 0x01 解决 https://golang.org/s/sty ...
- 羽夏看Win系统内核——简述
写在前面 此系列是本人一个字一个字码出来的,包括示例和实验截图.由于系统内核的复杂性,故可能有错误或者不全面的地方,如有错误,欢迎批评指正,本教程将会长期更新. 如有好的建议,欢迎反馈.码字不易, ...
- 一文看懂String类中的常用方法
1.int length(): 返回字符串的长度: return value.length 2.char charAt(int index): 返回某索引处的字符return value[index] ...
- TP5增加扩展配置目录
ThinkPHP5.0.1版本开始增加了扩展配置目录的概念,在应用配置目录或者模块配置目录下面增加extra子目录,下面的配置文件都会自动加载,无需任何配置. 这极大的方便了我们进行扩展配置,比如在a ...
- CSS 奇技淫巧 | 妙用混合模式实现文字镂空波浪效果
本文将介绍一个小技巧,通过混合模式 mix-blend-mode 巧妙的实现文字的镂空波浪效果. 起因 一日,一群友私聊问我.如何使用 CSS 实现下述效果,一个文字的波浪效果: 我当时想都没想,就回 ...
- NOI.AC#2144-子串【SAM,倍增】
正题 题目链接:http://noi.ac/problem/2144 题目大意 给出一个字符串\(s\)和一个序列\(a\).将字符串\(s\)的所有本质不同子串降序排序后,求有多少个区间\([l,r ...