【发布时间】:2020-08-08 10:19:26
【问题描述】:
在我的游戏中,我有从 a 点移动到 b 点的平台,当玩家出于某种原因降落在平台上时,他在平台上的速度会大大降低。
移动平台代码:
private void Start()
{
isActive = true;
}
void Update()
{
if (isActive == true)
{
transform.position = Vector3.Lerp(pos1, pos2, Mathf.PingPong(Time.time * speed, 1.0f));
}
}`
玩家有代码使他在碰撞时成为平台的孩子,以确保它不会从平台上掉下来。 :
if(other.gameObject.CompareTag("MGround"))
{
landEffect.Play();
playerSpeed = 8;
this.transform.parent = other.transform;
isJumping = false;
}
任何帮助将不胜感激。
【问题讨论】:
-
如果删除
playerSpeed = 8;部分会怎样? -
@MathewHD 我补充说以对抗减速:)
-
为什么玩家不能从平台上掉下来?