"PROJECT PROLECT"

Anything else
Prolect
Posts: 24
Joined: Sun Dec 27, 2009 4:04 pm

Re: "PROJECT PROLECT"

Post by Prolect » Thu Jan 07, 2010 6:44 pm

Endoperez wrote:
Prolect wrote: Oh yes, unity is definetly what I had in mind. I would LOVE any help with this seeing as I've only made very small games in blender (I am very much a n00b :P) so yeah would love your help and suggestions I am very open to :) A google wave account would be much appreciated, but I can work with about any way of chatting online.
Here's something to get started. I don't know how much experience you have, so it's really hard to approximate what's useful and what's not...

Do you know about Unify Wiki yet?

JavaScript tutorial from the basics (there are other tutorials and links to video tutorials if you know this already):
http://www.unifycommunity.com/wiki/inde ... JavaScript

It's an awesome resource of free scripts people have put up:
http://www.unifycommunity.com/wiki/inde ... le=Scripts


Then there's also the Scripting Reference, which you'll need to refer to all the time. As an example, let's say you want to move a GameObject, such as a ball. You open up the GameObject reference page.

In the variables, you can find transform and rigidBody. They both let you move and rotate GameObjects. The first ignores physics, the second moves using physics and only exists if you add a RigidBody component first.
Follow the link to Transform, and you'll get the Transform class. Again, check the functions first and you'll find Translate and Rotate and other useful functions. Now you can go and check for example Translate out, and you get examples and detailed instructions on how to use it: transform.Translate(Vector3.right * Time.deltaTime); . Here's an example that does stuff:

Code: Select all

//define important variables first
// create a new variable called 'object', make it to be of the type GameObject, change values
var object: GameObject;

// Start() is used for things that happen once in the beginning
function Start () {
   // if variable object has not been defined, create a box and assign it to object
   if( object == null ) {
        // print() prints text to console, open with shift+ctrl+C, console also shows errors in script
        print("null, creating cube");
        // the line below made a new Cube, but variable object was still unassigned
        // object.CreatePrimitive(PrimitiveType.Cube);
        object = GameObject.CreatePrimitive(PrimitiveType.Cube);
   }
   // change color, initial position
   object.renderer.material.color = Color.white;
   object.transform.position = Vector3(0,3,0);
} // {} define areas of influence. This } ends function Start. 

// Update() is used for things that change in time: movement, checking if a key is pressed down, movement that happens only if a key is pressed down...
// if you use a rigidbody, use it inside FixedUpdate() {} instead
function Update() {
    // Move the object to the right relative to the camera 1 unit/second.
    object.transform.Translate(Vector3.right * Time.deltaTime);
}
In Unity, right-click on project hierarchy window and choose Create - new JavaScript, edit the script and replace it with the code from above. Then drag-n-drop the script from hierarchy to the main camera. Scripts have to be assigned to a GameObject in play, otherwise they don't do anything. Press play and you should see a white cube moving.

Try removing the object from object.transform.Translate() , and you should see the camera moving. The default GameObject is the one the script has been assigned to.


You can use this:
http://unity3d.com/support/documentatio ... tAxis.html
to read input from joysticks, arrow keys etc.

Components called Colliders can stop objects moved by physics. Things inside OnCollisionEnter happen when two physics objects collide. If you change the collider into a Trigger by checking a box in Inspector window, it doesn't stop movement any more but works more like a motion detector: if something goes to the trigger area, something happens.

wow thanks XD

User avatar
Endoperez
Posts: 5668
Joined: Sun Jan 11, 2009 7:41 am
Location: cold and dark and lovely Finland

Re: "PROJECT PROLECT"

Post by Endoperez » Sun Jan 17, 2010 5:49 am

Any news on this?

Prolect
Posts: 24
Joined: Sun Dec 27, 2009 4:04 pm

Re: "PROJECT PROLECT"

Post by Prolect » Thu Jan 21, 2010 8:02 pm

Endoperez wrote:Any news on this?
Yes, it's going quite well. I have started work on character models for our first game, and we have an abundance of (unfinished) maps LOL.

Post Reply