当前位置:网站首页>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
边栏推荐
- Summary of evaluation indicators and important knowledge points of regression problems
- PIP related commands
- PTA 1102 教超冠军卷
- Simple configuration of single arm routing and layer 3 switching
- PHP面试题 foreach($arr as &$value)与foreach($arr as $value)的用法
- 如何选择合适的自动化测试工具?
- More than 10000 units were offline within ten days of listing, and the strength of Auchan Z6 products was highly praised
- Tips for short-term operation of spot silver that cannot be ignored
- Interview vipshop internship testing post, Tiktok internship testing post [true submission]
- 体总:安全有序恢复线下体育赛事,力争做到国内赛事应办尽办
猜你喜欢

我感觉被骗了,微信内测 “大小号” 功能,同一手机号可注册两个微信

简单几步教你如何看k线图图解

Do you really understand sticky bag and half bag? 3 minutes to understand it

Summary of evaluation indicators and important knowledge points of regression problems

gsap动画库

如何选择合适的自动化测试工具?

【C语言】字符串函数

Continuous test (CT) practical experience sharing

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

Improve application security through nonce field of play integrity API
随机推荐
Wireshark analyzes packet capture data * cap
线程池的拒绝策略
The live broadcast reservation channel is open! Unlock the secret of fast launching of audio and video applications
完整的电商系统
Reinforcement learning - learning notes 8 | Q-learning
Will low code help enterprises' digital transformation make programmers unemployed?
云景网络科技面试题【杭州多测师】【杭州多测师_王sir】
[principle and technology of network attack and Defense] Chapter 1: Introduction
静态路由配置
PHP面试题 foreach($arr as &$value)与foreach($arr as $value)的用法
nest. Database for getting started with JS
2022年推荐免费在线接收短信平台(国内、国外)
Discuss | what preparations should be made before ar application is launched?
Redis的发布与订阅
Simple configuration of single arm routing and layer 3 switching
How to clean when win11 C disk is full? Win11 method of cleaning C disk
3.关于cookie
[paper sharing] where's crypto?
如何选择合适的自动化测试工具?
nest.js入门之 database