我正在尝试为 Android 创建一个彩色凹凸游戏。我试图给球增加运动。但它不断显示错误,例如:错误 CS1503:参数 1:无法从“(UnityEngine.Vector3,UnityEngine.ForceMode)”转换为“Vector3”
谁能帮帮我!!!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BallController : MonoBehaviour
{
private Rigidbody rb;
private Vector3 lastMousePos;
public float sensitivity = .16f, clampDelta = 42f , bound = 5f;
// Start is called before the first frame update
private void Awake()
{
rb = GetComponent<Rigidbody>();
}
void Start()
{
}
private void FixedUpdate()
{
if (Input.GetMouseButtonDown(0))
{
lastMousePos = Input.mousePosition;
}
if (Input.GetMouseButton())
{
Vector3 newPosition = lastMousePos - Input.mousePosition;
lastMousePos = Input.mousePosition;
newPosition = new Vector3(newPosition.x,0,newPosition.y);
Vector3 moveForce = Vector3.ClampMagnitude(newPosition, clampDelta);
rb.AddForce((-moveForce*sensitivity-rb.velocity/5f,ForceMode.VelocityChange));
}
rb.velocity.Normalize();
}
// Update is called once per frame
void Update()
{
}
}
我想清除错误并根据android平台进行运动。