当前位置:网站首页>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
边栏推荐
- 微信网页调试8.0.19换掉X5内核,改用xweb,所以x5调试方式已经不能用了,现在有了解决方案
- Nunjuks template engine
- idea彻底卸载安装及配置笔记
- Redis的发布与订阅
- Interview vipshop internship testing post, Tiktok internship testing post [true submission]
- Hash, bitmap and bloom filter for mass data De duplication
- Thread factory in thread pool
- 国内的软件测试会受到偏见吗
- 嵌入式面试题(算法部分)
- RIP和OSPF的区别和配置命令
猜你喜欢
【C语言】字符串函数
Hash, bitmap and bloom filter for mass data De duplication
Summary of debian10 system problems
Some key points in the analysis of spot Silver
简单几步教你如何看k线图图解
CVPR 2022 - learning non target knowledge for semantic segmentation of small samples
Ten thousand words nanny level long article -- offline installation guide for datahub of LinkedIn metadata management platform
[principle and technology of network attack and Defense] Chapter 1: Introduction
链式二叉树的基本操作(C语言实现)
Tips for short-term operation of spot silver that cannot be ignored
随机推荐
【软件测试】从企业版BOSS直聘,看求职简历,你没被面上是有原因的
[principle and technology of network attack and Defense] Chapter 1: Introduction
GSAP animation library
Tsinghua, Cambridge and UIC jointly launched the first Chinese fact verification data set: evidence-based, covering many fields such as medical society
Comparison and selection of kubernetes Devops CD Tools
Classification of regression tests
debian10系统问题总结
备份阿里云实例-oss-browser
2022年理财产品的一般收益率是多少?
Wireshark分析抓包数据*.cap
Recommend free online SMS receiving platform in 2022 (domestic and foreign)
Cloud security daily 220707: Cisco Expressway series and telepresence video communication server have found remote attack vulnerabilities and need to be upgraded as soon as possible
财富证券证券怎么开户?通过链接办理股票开户安全吗
[C language] string function
NAT地址转换
“解密”华为机器视觉军团:华为向上,产业向前
go语言的字符串类型、常量类型和容器类型
[principle and technology of network attack and Defense] Chapter 7: password attack technology Chapter 8: network monitoring technology
Afghan interim government security forces launched military operations against a hideout of the extremist organization "Islamic state"
国内的软件测试会受到偏见吗