当前位置:网站首页>UE4 makes crosshair + recoil
UE4 makes crosshair + recoil
2022-07-29 23:51:00 【flying pig】
I. Introduction
We often use the crosshair to aim and shoot in the process of shooting game development. There are many ways to do this function. Today, I will teach you a method that can adjust the size of the crosshair by yourself.Its principle is: use the material to make a crosshair, and then adjust the material parameters to achieve the expansion and scaling of the crosshair.The principle of recoil is to hit the object with a ray from the camera, and then add a position offset to the aiming direction, and the final aiming direction is the original aiming direction plus the shooting offset.
II. Introduction to ideas
Shooting aiming is aimed at the camera, that is, the center of the screen is issued, and the crosshair is drawn in the center of the screen.
The direction of the shooting is mainly achieved by the ray detection of UE4 to achieve the position of the shooting
The offset is mainly an offset on the X-axis, Y-axis, and Z-axis of the hit position
The position displayed on the screen is mainly added to the screen by UMG
Three. Cases
Step 1: Create a material to draw the crosshair
Create a UMG, add a picture, and add the created crosshair material into it
Open the FirstPersonCharacter blueprint to add the UMG to the screen
Step 2: Open the first-person FirstPersonCharacter, and set the displacement offset according to the principle. I created a pure virtual function here.LocationOffset function
The third step, the recoil trajectory changes, use the timeline to make an animation curve
Two parameters of the curve (0,1), (0.5,0);
The fourth step: the left mouse button to fire the design, use LineTranceForObjects ray detection to detect the position of the shooting, and generate particle effects.
Three, the effect is as follows
边栏推荐
猜你喜欢
MySQL active/standby switch
接口测试的概念、目的、流程、测试方法有哪些?
读书笔记:《这才是心理学:看穿伪心理学的本质(第10版)》
【无标题】清空吗
go语言(函数、闭包、defer、panic/recover,递归,结构体,json序列化与反序列化)
彻底搞懂kubernetes调度框架与插件
Access Modbus TCP and Modbus RTU protocol devices using Neuron
jenkins搭建部署详细步骤
Farmers on the assembly line: I grow vegetables in a factory
Brute force recursion to dynamic programming 04 (digital string conversion)
随机推荐
全网最强 JVM 来袭!(至尊典藏版)
Windows 安装 MySQL 5.7详细步骤
Install PyCharm on Raspberry Pi
Allure环境部署与生成+Allure内容增强
MQTT over QUIC: The Next-Generation IoT Standard Protocol Brings New Impetus to Messaging Scenarios
logback过期日志文件自动删除
esp12f + tft display picture problem
Prometheus 的功能特性
2022/7/29 考试总结
全国双非院校考研信息汇总整理 Part.3
SQL Server、MySQL主从搭建,EF Core读写分离代码实现
学会使用MySQL的Explain执行计划,SQL性能调优从此不再困难
【leetcode】The sword refers to Offer II 002. Binary addition
线上无序的
LabVIEW为什么在存储VI时死机
多商户商城系统功能拆解18讲-平台端商家售后
[2023 School Recruitment Questions] Summary of knowledge points and hand-tear code in the written test and interview
Tkinter:功能按钮Button
1326. 灌溉花园的最少水龙头数目 动态规划
437. 路径总和 III ●●