400 boxes?

Hello unity-community :slight_smile:

I am considering buying an imac in order to install unity3d (I don’t feel like waiting till unity 2.5 is released for PC). I am looking around the documentation, reviews, forum and the tutorials trying to get a feel if I should spend the 1.5K for the imac. So far so good. I am a little worried about the java script though and how much you can do with it. For example, say I want to create a floor with 400 tiles (20x20). Can I create the boxes through java script?

normally I would want to write something like:

private final Box[][] tile = new Box[20][20];
for(int i = 0; i < 20; i++){
    for(int j = 0; j < 20;j++){
        tile[i][j] = new Box("tile"+i+j,new Vector3f(),1,0.25f,1);
    	tile[i][j].getLocalTranslation().set(2*i, 0, 2*j);
}

I know js doesn’t support multi-dimensional arrays directly but can I create/destroy unity objects through script? Example of this?
sorry but I couldn’t find an answer to this.
thanks vm

read that stuff also the documentation

goto unity3d.com

support

documentaion

Wow that was quick! Thanks Alex for the immediate reply. I guess createPrimitive is what I was looking for. Sorry I didn’t see it the first time…

Or to flex Unity’s muscle a bit better, check the docs and read up on using Instantiate in combination with prefabs. You make prefabs at author time (can be a model, a model with scripts, a model with scripts and animations, etc.), then you instantiate that at run-time using, well, Instantiate. Very powerful stuff.

Great! You guys convinced me! I have unity running now and another noobish question:
How do I change the number of Triangles (and Vertices) of a plane?
I want my plane to be a simple quad built with 2 triangles and 4 vertices. When I add a plane it’s drawn with 200 triangles though and I haven’t been able to figure out how to change this?

thanks

uhh, nevermind. I found a post in the forum saying it is not possible. thanks

Instantiate looks really cool, but how do I attach newly created objects as children? I don’t see an attach/add child method?

Each Game Object has a transform, and the transform offers a parent property that can be set as needed.

Yeah, you probably want to just make one of your own in a 3d package and import it as an FBX. :slight_smile:

@HiggyB: perfect. that makes sense. thanks again.

@Nathan: :slight_smile: I am so new to Unity and game development as a whole, I don’t have a 3D package. Unity should ship with a quad if you ask me.

Anyway, I will try to use the Mesh class to create some quads. I will let you know when I stumble :slight_smile:

Unity is not nor do we want it to be a modeling tool, as such it offers you a basic plane primitive and a raw mesh class if you want to build on the fly. If you need a modeling tool then look into Blender (free) or something like Cheetah 3D ($149), inexpensive and well integrated with Unity.

Have fun!

I agree, it should have a 2 tri plane, the mesh class is a pain because you have to make a UV for it too if you want a decent texture on it…

Instead, use this :slight_smile:

118418–4483–$planefbx_836.zip (11.8 KB)

Excellent! Works beautifully :slight_smile: Thanks a million.

You’re welcome :slight_smile:

So far the most difficult part is actually purchasing Unity3d (with iPhone Basic). The payment system wouldn’t take my card so I had to pay using paypal. Does anyone have an idea how long it would take them to send me a code and a download link for the iPhone Basic?
I left a message and sent an e-mail but no reply yet. I was hoping to get it today so I can play with it during the long weekend :slight_smile:

thanks

PS: I understand this post is quite off topic. Sorry, I will try not to do it again :slight_smile:

Most credit card companies will automatically deny any purchase over X number of dollars from unknown merchants. Usually a five minute phone-call with your card company will fix it. Something along the lines of “Hi, I am Mr. Smith, I authorize payment to the merchant on that last blocked purchase.”

thanks for the reply. However I was stupid and used the paypal option. Unity has received my payment, but hasn’t sent me anything yet. Hopefully they will do it on Tuesday now since it’s already quite late…

thanks

If you used pay-by-check then it can take a few days to clear and only then will your license be generated and sent. I don’t see a license generated for you just yet, if you’re very time sensitive about this then drop me a line outside this thread (PM here on the forums or via email) and I’ll get you sorted with a trial license to use while you wait.

Sorry to be blunt but, why do you do it when you know it’s not proper etiquette? Don’t “try not to do it again”, just don’t do it. Thanks.