Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
Basic Level Generator

jaimezegpi
Registered User
Quote
2015-08-04 22:30:05

🔎︎


Play!.
http://brainxcode.cl/develop/gro...

Download
http://brainxcode.cl/develop/gro...


In CCB..
Make a folder named "scene"
include in them all models you need..

Make a ground and excecute this code.

CODE:


var root = ccbGetSceneNodeFromName("scene");
var count = ccbGetSceneNodeChildCount(root);
var name=[];
for(var i=0; i<count; ++i)
{
var child = ccbGetChildSceneNode(root, i);
print("node:" + ccbGetSceneNodeProperty(child, "Name") + "\n");
name.push( ccbGetSceneNodeProperty(child, "Name") );
}
//-------------------------------------
var matrix_width = 20;
var matrix_height = 20;
var block_width = 5;
var block_height = 5;
var bx=0;
var by=0;
var road_width=1;
var scale_object=10;
var custom_alt=0;
var random_object_number=1;
//--------------------------------------

for (mx=0;mx<matrix_width;mx++)
{
bx=bx+1;
by=0;
for (mz=1;mz<matrix_height;mz++)
{
by=by+1;
if (bx<block_width && by<block_height )
{
random_object_number=Math.floor((Math.random() * (count-1) ) + 1);
var sourceNode = ccbGetSceneNodeFromName(name[random_object_number]);
var newscenenode = ccbCloneSceneNode(sourceNode);
custom_alt=ccbGetCollisionPointOfWorldWithLine(mx*scale_object,1000, mz*scale_object, mx*scale_object,-1000, mz*scale_object);
if (custom_alt)
{
ccbSetSceneNodeProperty(newscenenode , "Position", mx*scale_object,custom_alt.y, mz*scale_object);
}else{
ccbSetSceneNodeProperty(newscenenode , "Position", mx*scale_object,0, mz*scale_object);
}

}

if (by>block_height+road_width)
{by=0;}
print(mx+":"+mz);

}

if (bx>block_width+road_width)
{
bx=0;
}

}




erik
Registered User
Quote
2015-08-05 19:41:27

Hm, what does that do exactly?


jaimezegpi
Registered User
Quote
2015-08-06 17:33:54

basic.
make a matrix and pos random elements separated in bloqs, and calculate alture to post in terrain

XXXX XXXX XXXX XXXX
XXXX XXXX XXXX XXXX
XXXX XXXX XXXX XXXX

XXXX XXXX XXXX XXXX
XXXX XXXX XXXX XXXX
XXXX XXXX XXXX XXXX

XXXX XXXX XXXX XXXX
XXXX XXXX XXXX XXXX
XXXX XXXX XXXX XXXX


AnAverageGuest
Guest
Quote
2020-04-10 00:13:57

Can someone make a tutorial on how to use this?


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact