当前位置:网站首页>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
边栏推荐
- [principles and technologies of network attack and Defense] Chapter 3: network reconnaissance technology
- Yunjing network technology interview question [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
- Will low code help enterprises' digital transformation make programmers unemployed?
- Unlike the relatively short-lived industrial chain of consumer Internet, the industrial chain of industrial Internet is quite long
- 6.关于jwt
- Using stored procedures, timers, triggers to solve data analysis problems
- Save the memory of the model! Meta & UC Berkeley proposed memvit. The modeling time support is 30 times longer than the existing model, and the calculation amount is only increased by 4.5%
- 【demo】循环队列及条件锁实现goroutine间的通信
- 【软件测试】从企业版BOSS直聘,看求职简历,你没被面上是有原因的
- Thread factory in thread pool
猜你喜欢
Summary of debian10 system problems
你真的理解粘包与半包吗?3分钟搞懂它
[paper sharing] where's crypto?
现货白银分析中的一些要点
Differences between rip and OSPF and configuration commands
The report of the state of world food security and nutrition was released: the number of hungry people in the world increased to 828million in 2021
DataSimba推出微信小程序,DataNuza接受全场景考验? | StartDT Hackathon
Comparison and selection of kubernetes Devops CD Tools
清华、剑桥、UIC联合推出首个中文事实核查数据集:基于证据、涵盖医疗社会等多个领域
Nunjuks template engine
随机推荐
标准ACL与扩展ACL
『HarmonyOS』DevEco的下载安装与开发环境搭建
将模型的记忆保存下来!Meta&UC Berkeley提出MeMViT,建模时间支持比现有模型长30倍,计算量仅增加4.5%...
Will low code help enterprises' digital transformation make programmers unemployed?
Wireshark analyzes packet capture data * cap
Simple configuration of single arm routing and layer 3 switching
强化学习-学习笔记8 | Q-learning
你真的理解粘包与半包吗?3分钟搞懂它
[C language] string function
现在网上期货开户安全吗?国内有多少家正规的期货公司?
PTA 1101 B是A的多少倍
Wireshark分析抓包数据*.cap
Hash, bitmap and bloom filter for mass data De duplication
[sword finger offer] 59 - I. maximum value of sliding window
卖空、加印、保库存,东方甄选居然一个月在抖音卖了266万单书
GSAP animation library
The report of the state of world food security and nutrition was released: the number of hungry people in the world increased to 828million in 2021
Tsinghua, Cambridge and UIC jointly launched the first Chinese fact verification data set: evidence-based, covering many fields such as medical society
Disk storage chain B-tree and b+ tree
伺服力矩控制模式下的力矩目标值(fTorque)计算