- Home /
iOS / Android Steering
Hi!
I'm fairly new to unity, and I was looking for a tutorial or some scripts with wich I can steer a Car using Android / Iphone.. I was planning on working through the Penelope tutorial (it's interchangeable betweet iOS & Android, right?), but seeing that that it is a 3d person tutorial, I was hoping someone could point me in the driving direction..
Or is it maybe possible to tweak the script from the Car Tutorial, since i've done that Tutorial a couple of times now..
Anybody any suggestions on where to look?
Thanks in advance! Thomas
Answer by Macdude2 · Mar 30, 2011 at 02:53 AM
Also, if you have not bookmarked it, the unity reference manual is full of good information and some basic application script of iphone and android touch based code. The Unity Wiki is also a great place to find information and code.
Script Reference: http://unity3d.com/support/documentation/ScriptReference/
Unity Wiki: http://www.unifycommunity.com/wiki/index.php?title=Scripts
Below is the script reference link to some basic script describing how to use the accelerometer:
http://unity3d.com/support/documentation/ScriptReference/Input-acceleration.html
Below is some of the only code from the car controller that would need to be converted to work with the iphone:
However, if you want to make a car game for the iphone, their is a lot of superfluous code that you would need to edit out of the car.js script included in the car tutorial assets to make the physics and effects simpler.
Good luck with your project.
function GetInput() { throttle = Input.GetAxis("Vertical"); steer = Input.GetAxis("Horizontal");
if(throttle < 0.0)
brakeLights.SetFloat("_Intensity", Mathf.Abs(throttle));
else
brakeLights.SetFloat("_Intensity", 0.0);
CheckHandbrake();
}
function CheckHandbrake()
{
if(Input.GetKey("space"))
{
Answer by Justin Warner · Mar 30, 2011 at 02:35 AM
If you're fairly new to this... I suggest reading through the tutorials... I personally didn't do them, because that's like me just copy paste 'ing code... So I suggest just going through them, seeing how to do different things... Now, don't go through the tutorial, but recreate something similar... Now, keep on adding things to make it actually closer and closer to the real product, and learn step by step...
ANYTHING, will help you... Don't just stay on Android/iOS stuff, just make sure when you code for your project for the PC, LOOK at the actual iOS and Android in the API, to see how you'd do that for it...
Just my opinion though =).
Your answer
Follow this Question
Related Questions
How to make camera position relative to a specific target. 1 Answer
Android/IOS First Person Shooter 2 Answers
Touchscreen car controls 2 Answers
About unity's API for android? 2 Answers
Android not working 1 Answer