简体   繁体   English

在 Unity3D 中获取 PS3 控制器输入

[英]Getting PS3 controller input in Unity3D

I want my PS3 controller to control my unity game, and so far it isn't going well.我希望我的 PS3 控制器能够控制我的 Unity 游戏,但目前进展并不顺利。 I have it plugged into my computer via the USB cable it came with.我通过它附带的 USB 电缆将它插入我的计算机。 My computer did not install any drivers when I plugged it in, but it did make a sound and Unity seems to have detected it, printing Joystick Connected (controller name here)我的电脑在插入时没有安装任何驱动程序,但它确实发出声音并且 Unity 似乎已经检测到它,打印Joystick Connected (controller name here)

Unfortunately, beyond that the controller does absolutely nothing.不幸的是,除此之外,控制器绝对什么都不做。 I have gone to the input menu and have adjusted input according to this map: http://forum.unity3d.com/threads/ps3-button-map.89288/我已经进入输入菜单并根据这张地图调整了输入: http : //forum.unity3d.com/threads/ps3-button-map.89288/ 在此处输入图片说明

but still get nothing.但仍然一无所获。 Not a single button does anything.没有一个按钮可以做任何事情。

I should also mention if this helps, this is how I'm getting input:我还应该提到这是否有帮助,这就是我获得输入的方式:

void FixedUpdate()
{
    float movehorizontal = Input.GetAxis("Horizontal");
    float movevertical = Input.GetAxis("Vertical");
    Vector3 movement = new Vector3(movehorizontal, 0, movevertical);
    rb.AddForce(movement * speed);
}

You need a special driver in order to get your PS3 controller to work on PC.您需要一个特殊的驱动程序才能让您的 PS3 控制器在 PC 上运行。 I highly recommend ScpToolkit .我强烈推荐ScpToolkit It's the best one out there.这是最好的一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM