I am totaly new to Unity but after trying it for 10 days i am already convinced to buy one. But that was'nt my question anyway ... i am trying different things and methods with Unity and now i cannot move sphere on a plane. How do i do that? I have a script that is rotating the ball but don't know how to force it to roll on the plane. Any hepl will be a big step forward. Thanx Peter
This is the kind of thing you probably want. Also make sure a rigidbody is attached to the sphere. Code (csharp): function FixedUpdate () { var ver = Input.GetAxis("Vertical"); rigidbody.AddRelativeTorque (0,0,ver); }
Thanx for the quick answer. I applied the script to the sphere but nothing seems 2 happen. The sphere has a rigidbody. Is there anything else i need to do. Anyone can Help?????
This script applys rotational force when you use the up/down keys or w/s keys (if you haven't changed the input config). Press the keys and it should roll. If you want to have the ball always roll go for something like this: Code (csharp): function FixedUpdate () { rigidbody.AddRelativeTorque (0,0,1); }
OK thanx, i tried that and yes it rolls but what i want to happen is when i press arrows it starts to move and rolls the direction it moves. Just like in Marble Blast game http://www.youtube.com/watch?v=258M9RTXzSM Sorry for so many questions
like this? Code (csharp): var speed = 0.00; var force = 0.00; function FixedUpdate () { var oldAngle = Camera.main.transform.localEulerAngles.x; Camera.main.transform.localEulerAngles.x = 0; var spin = Camera.main.transform.TransformDirection(Vector3(Input.GetAxis("Vertical") * speed, 0, -Input.GetAxis("Horizontal") * speed)); Camera.main.transform.localEulerAngles.x = oldAngle; rigidbody.AddTorque((spin - rigidbody.angularVelocity) * force); }
it works but still...sorry.. it jumps funny and doesn't move like it should. What other scripts should i add? Should there be a character controller.
That is exactly what i was trying to do. I didn't have the Main Camera Mouse Orbit script (is it a standard script that comes with Unity - i just have a trial version). And in the SphereCollider the Center XYZ position data... is that important? Anyway, thank You very much drag0nsphere. Now i will move forward Thanx again.
im not sure if it comes with the trial...... yes you need the sphere collider or it will go through the plane.
Anyway i will buy it after trial . Last question, how can i make it jump, i checked the input settings and it is OK (spacebar as jump button) or is something else i need to do? Peter
You are saving my life . I hop i'll be able to pay back for that. Can i add this code to your Control script? Or should i do it other way? thanx in advance.