当前位置:网站首页>The moveposition function of rigidbody2d of unity2d solves the problem of people or screen jitter when moving
The moveposition function of rigidbody2d of unity2d solves the problem of people or screen jitter when moving
2022-07-07 18:55:00 【Cingke is true】
This is a 2d Rigid body movement function
public void controlHero()
{
if ((ETCInput.GetAxis("Vertical") != 0) || (ETCInput.GetAxis("Horizontal") != 0)){
rigidbody2D.MovePosition(rigidbody2D.position+Time.fixedDeltaTime*new Vector2(ETCInput.GetAxis("Horizontal"),ETCInput.GetAxis("Vertical")) * speed );
}
// as everyone knows , When the character moves, multiply by Time.fixedDeltaTime, Equivalent to logic in FixedUpade Call in , Every interval 0.02s Move once ;
}
I started with FixedUpdate() Call in , As a result, the character shook unexpectedly , It has been changed many times , Think it's not smooth enough to move , Only later did I know , Consider the following rendering of the camera , Generally, the camera follows LateUpdate in , And I used cinemachine Also in LateUpdate in , Decisively changed to in LateUpdate Call the mobile function in , No shaking .
private void LateUpdate()
{
controlHero();
}
}
Okay, put it on Update It's fine too
边栏推荐
- nest. Database for getting started with JS
- Kirk borne's selection of learning resources this week [click the title to download directly]
- idea彻底卸载安装及配置笔记
- 线程池和单例模式以及文件操作
- 【demo】循环队列及条件锁实现goroutine间的通信
- Download, installation and development environment construction of "harmonyos" deveco
- Discuss | frankly, why is it difficult to implement industrial AR applications?
- 备份阿里云实例-oss-browser
- Idea completely uninstalls installation and configuration notes
- 持续测试(CT)实战经验分享
猜你喜欢
A few simple steps to teach you how to see the K-line diagram
Static routing configuration
The live broadcast reservation channel is open! Unlock the secret of fast launching of audio and video applications
Datasimba launched wechat applet, and datanuza accepted the test of the whole scene| StartDT Hackathon
Redis
Redis集群与扩展
Tear the Nacos source code by hand (tear the client source code first)
String type, constant type and container type of go language
直播预约通道开启!解锁音视频应用快速上线的秘诀
socket编程之常用api介绍与socket、select、poll、epoll高并发服务器模型代码实现
随机推荐
[Tawang methodology] Tawang 3W consumption strategy - U & a research method
[demo] circular queue and conditional lock realize the communication between goroutines
现在网上期货开户安全吗?国内有多少家正规的期货公司?
Reject policy of thread pool
Nat address translation
静态路由配置
Interview vipshop internship testing post, Tiktok internship testing post [true submission]
pip相关命令
【软件测试】从企业版BOSS直聘,看求职简历,你没被面上是有原因的
【C语言】字符串函数
[principle and technology of network attack and Defense] Chapter 1: Introduction
Kubernetes DevOps CD工具对比选型
强化学习-学习笔记8 | Q-learning
Idea completely uninstalls installation and configuration notes
Charles+Postern的APP抓包
如何选择合适的自动化测试工具?
Simple configuration of single arm routing and layer 3 switching
[principle and technology of network attack and Defense] Chapter 6: Trojan horse
The live broadcast reservation channel is open! Unlock the secret of fast launching of audio and video applications
Unlike the relatively short-lived industrial chain of consumer Internet, the industrial chain of industrial Internet is quite long