【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 ...
随机推荐
- Node.js 应用全链路追踪技术——[全链路信息获取]
全链路追踪技术的两个核心要素分别是 全链路信息获取 和 全链路信息存储展示. Node.js 应用也不例外,这里将分成两篇文章进行介绍:第一篇介绍 Node.js 应用全链路信息获取, 第二篇介绍 N ...
- 基于Appium,封装自己的常用方法
Appium算是老牌移动端App自动化测试工具了,在使用它的过程中,使用者经常会根据个人习惯,把较常用的方法封装在一起,方便调用.以下是我的封装,希望对你有启发. from typing import ...
- python代码检查工具(静态代码审查)
python静态代码检查 我们知道python是一门脚本语言,不像C#/Java等编译型语言可以在编译阶段就报出代码错误,脚本语言往往需要在运行期执行到这段代码时才会抛出代码错误. 那么在实际商业项目 ...
- [考试总结]noip模拟44
这个真的是一个 \(nb\) 题. 考试快要结束的时候,在机房中只能听到此起彼伏的撕吼. 啊---------- 然后人们预测这自己的得分. \(\color{red}{\huge{0}}\) \(\ ...
- tornado2.2安装教程
最近要用到vxworks 系统,所以避免不了要安装tornado 软件,进行相关的开发. 自己在安装过程中遇到了点点问题,这里记录下来,免得以后再次安装时遇到同样的问题. 1. 首先提供一个tor ...
- uniapp 获取用户手机号
参考资料: 微信小程序官方文档 uniapp开发微信小程序获取用户手机号 页面增加一个按钮 <button open-type="getPhoneNumber" @getph ...
- 在开发中使用GMap.Net 控件的心得一
首先必须先加载GMap.Net这个控件,先通过"添加引用"来加载相应的.dll文件,如果在工具箱中找不到GMapControl这个控件,也别心急. 点击"工具" ...
- CodeForce-702C Cellular Network(查找)
Cellular Network CodeForces - 702C 给定 n (城市数量) 和 m (灯塔数量): 给定 a1~an 城市坐标: 给定 b1~bm 灯塔坐标: 求出灯塔照亮的最小半径 ...
- PC端利用Xshell连接Android上的Termux
需要准备的工具 Android端:Termux.RE管理器 PC端:Xshell 开始操作 1. 启动Termux,安装openssh pkg install openssh 2. 安装好后,启动ss ...
- Java on Visual Studio Code的更新 – 2021年8月
Nick Senior Program Manager, Developer Division at Microsoft 大家好,欢迎来到 8 月版的 Visual Studio Code Java ...