I am in a project to develop a car racing game for iPhone (well yeah, there are lots out of there but this is just a project of mine). After sometime playing around with Unity3D, I can get a grasp on how to make a decent racing game on Unity. But I have some scripting problems with Unity iPhone. I found JCar script of C# from the wiki. Just by inserting a cube, some wheels and the game runs fine with JCar. So my question here is how to make controller script for iPhone? From Roll-a-Ball example, there’s a hint on how to control the movement through iPhone controller thing. But the example’s in Javascript. I am not a heavy programmer since I am more to multimedia person so I find it’s hard to understand some of the codes especially when Unity could understand both JS and CS. I also wanted to add GUI controller and others. Again, different examples with different programming languages made me dumbfounded.
I am actually on the trial mode and willing to pay for the full program after my trial ended. Unity itself is a great development tool for games especially on Mac, Windows and also browsers. Unity iPhone still at infant stage, I believe, with various tools from Unity applied on it. But real problems arise whenever examples have different sources like JS and CS. Plus less examples on Unity iPhone.
I hope someone can help me regarding my matters above. Thanks.
i am pretty sure, that i have once again not the right axis (happens everytime ), so try switching x/y/z for steer and accel until the car reacts how you want
Hi,
welcome here
this code i use for steering a car with the iPhone.
If you need more info about just do a search here with “iPhoneInput.acceleration”
and use Script Forum or IPhone Forum only and you will get all Code Info about.
is there any 3d racing project sample running on unity iPhone for i can learn?
i really newbie and i think it would be helping when learn from sample project.
Well, I commented the errors out. And the second thing, is that you have to compressed all the textures to PVRTC. The editor crashes if I hit play, but it runs fine on the Iphone
Thanks Cedar, it really help.
Now the problem is the “terrain component” wont load in Unity iPhone but it works in Unity for Mac osx.
Any suggest? Thanks.
Well, you have two options:
Either you use a plane ( for testing ) or a mesh modelled in a modelling application
Although, if you want to use the terrain provided inside or jcar example, you will need to attach the terrain to .obj script found in the unity wiki and hit run: i will export a mesh equal to the terrain. Now grab the transform position offer the terrain in unity and open the jcar project in unityiphone, import the obj mesh and give it the same coordinTes or the terrain
Yes, what I did is to remove the offending script, but that is a cheap fix.
Also, get rid of Unity Terrain and create a plane mesh or bring a static mesh from your favorite 3D app.
Thank you guys for the updates, I’m not great with pragma strict stuff or programming for that matter…
Thanks for your help. Eventually, your coding works as Unity iPhone didn’t detect any error but having problems transferring the project onto my iPhone. Xcode says interrupted. I am trying to see what’s the problem with my project.
Anyway, thanks to everybody who are helping in this topic. Will catch back to you soon.