- Home /
Cross platform Xbox 360 controller (PC,Mac,Xbox 360/One)
Hi everyone,
Concerning the main differences in axis:
Should I do something like if (Application.platform == {some platform}) and act accordingly?
How do you handle this? Any best practice advice?
Thanks
also looking for a solution here. the mappings for mac are different than pc. it'd be nice to set these up at runtime.
Answer by deprofundiis · Jan 26, 2015 at 12:30 PM
I did this:
//controller axis on mac are different beasts with different axis
if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer){
if (Input.GetAxis("Mouse X") < -callibration || Input.GetAxis("Mouse X") > callibration ||
Input.GetAxis("XboxMac X") < -callibration || Input.GetAxis("XboxMac X") > callibration)
cursorX += (Input.GetAxis("Mouse X") + Input.GetAxis("XboxMac X")) * sensitivityX;
if (Input.GetAxis("Mouse Y") < -callibration || Input.GetAxis("Mouse Y") > callibration ||
Input.GetAxis("XboxMac Y") < -callibration || Input.GetAxis("XboxMac Y") > callibration)
cursorY -= (Input.GetAxis("Mouse Y") + Input.GetAxis("XboxMac Y")) * sensitivityY;
}
else {
if (Input.GetAxis("Mouse X") < -callibration || Input.GetAxis("Mouse X") > callibration)
cursorX += Input.GetAxis("Mouse X") * sensitivityX;
if (Input.GetAxis("Mouse Y") < -callibration || Input.GetAxis("Mouse Y") > callibration)
cursorY -= Input.GetAxis("Mouse Y") * sensitivityY;
}
Not sure if there is a better way. Just act accordin to platform and define the necessary inputs in Input Manager and you are set ;)
Your answer
Follow this Question
Related Questions
How to get xBox mapping consistent on mac and pc? 0 Answers
360 controller for mac 1 Answer
XBox 360 controller on PC support? 1 Answer
Is there a way to automatically detect if a game is running on a Mac or PC? 2 Answers
Movie Texture 0 Answers