当前位置:网站首页>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
边栏推荐
- 国内的软件测试会受到偏见吗
- [paper sharing] where's crypto?
- [sword finger offer] 59 - I. maximum value of sliding window
- The live broadcast reservation channel is open! Unlock the secret of fast launching of audio and video applications
- [principles and technologies of network attack and Defense] Chapter 5: denial of service attack
- [software test] from the direct employment of the boss of the enterprise version, looking at the resume, there is a reason why you are not covered
- [principle and technology of network attack and Defense] Chapter 6: Trojan horse
- Five network IO models
- 3.关于cookie
- PIP related commands
猜你喜欢

GSAP animation library

More than 10000 units were offline within ten days of listing, and the strength of Auchan Z6 products was highly praised

伺服力矩控制模式下的力矩目标值(fTorque)计算

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%

【C语言】字符串函数

Static routing configuration

Discuss | frankly, why is it difficult to implement industrial AR applications?

强化学习-学习笔记8 | Q-learning

持续测试(CT)实战经验分享

Idea completely uninstalls installation and configuration notes
随机推荐
Thread factory in thread pool
Charles+Postern的APP抓包
debian10编译安装mysql
云安全日报220707:思科Expressway系列和网真视频通信服务器发现远程攻击漏洞,需要尽快升级
[unity shader] insert pass to realize the X-ray perspective effect of model occlusion
“解密”华为机器视觉军团:华为向上,产业向前
Live broadcast software construction, canvas Text Bold
Redis集群与扩展
The live broadcast reservation channel is open! Unlock the secret of fast launching of audio and video applications
CVPR 2022丨学习用于小样本语义分割的非目标知识
Ten thousand words nanny level long article -- offline installation guide for datahub of LinkedIn metadata management platform
Kirk Borne的本周学习资源精选【点击标题直接下载】
[sword finger offer] 59 - I. maximum value of sliding window
【C语言】字符串函数
卖空、加印、保库存,东方甄选居然一个月在抖音卖了266万单书
二叉树的基本概念和性质
Do you really understand sticky bag and half bag? 3 minutes to understand it
Skills of embedded C language program debugging and macro use
行业案例|数字化经营底座助力寿险行业转型
Wireshark分析抓包数据*.cap