2
尽管使用了Time.deltaTime,但移动似乎与帧速率有关。
我有以下代码来计算在Unity中移动游戏对象所需的转换LateUpdate。据我了解,我对的使用Time.deltaTime应使最终的翻译帧速率独立(请注意CollisionDetection.Move(),仅用于进行射线广播)。 public IMovementModel Move(IMovementModel model) { this.model = model; targetSpeed = (model.HorizontalInput + model.VerticalInput) * model.Speed; model.CurrentSpeed = accelerateSpeed(model.CurrentSpeed, targetSpeed, model.Accel); if (model.IsJumping) { model.AmountToMove = new Vector3(model.AmountToMove.x, model.AmountToMove.y); } else if (CollisionDetection.OnGround) { model.AmountToMove = new Vector3(model.AmountToMove.x, 0); } model.FlipAnim = flipAnimation(targetSpeed); // If we're ignoring gravity, then just …
13
unity
movement
frame-rate
timestep
collision-detection
unity
physics
opengl
libgdx
textures
graphics
c#
unity
vector
sfml
c
opengl
gui
multithreading
unity
mathematics
projection
mesh
unity
rigid-body-dynamics
rigidbody
c#
unity
2d
path-finding
procedural-generation
navmesh
unity
textures
maya
rigging
copyright
transformation
skeletal-animation
assimp
model-loader