如何使GameObject产生摩擦,类似于汽车,因此当转弯时,速度随之“转”

从本质上讲,我想要的是我的玩家不仅要转弯,而且还要转弯速度。

它已经加快了正确的速度。我只是想让它而不是漂移,而是转弯,而不是旋转。

using System.Collections.Generic;
using UnityEngine;
using System;
public class PlayerController : MonoBehaviour {
    public GameObject player;
    public Vector3 Vector;
    public float TurnSpeed=0;
    // Start is called before the first frame update
    void Start()
    {



    }

    // Update is called once per frame
    void Update()
    {
        Vector3 Movement = new Vector3(0,Input.Getaxis("Vertical"));
        {
            TurnSpeed += -(float)Input.Getaxis("Horizontal");
            //player.transform.position += new Vector3(0,Input.Getaxis("Vertical")*.3f,0);
            player.transform.Rotate(0,(float)TurnSpeed*2);
            Vector= new Vector3(0f,Input.Getaxis("Vertical"),0f);
            player.getcomponent<Rigidbody2D>().AddRelativeForce(Vector*12);
            TurnSpeed = TurnSpeed*.5f;
        }
    }
}
boggie0909 回答:如何使GameObject产生摩擦,类似于汽车,因此当转弯时,速度随之“转”

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3129892.html

大家都在问