Still in need of a RIGGER!
 
Back to the forumHomeFAQMemberlistUsergroupsRegisterLog inSearch

Share | 
 

 Chapter One Review And Examples(Webplayers Too!)

View previous topic View next topic Go down 
AuthorMessage
Myhijim
CoreDev CEO
CoreDev CEO


Posts : 66
Join date : 2012-09-07
Location : Sydney, Australia

20121017
PostChapter One Review And Examples(Webplayers Too!)

Congrats guys/girls, you have made it this far!

Now I thought I would create this post just to have a bit of fun with our newly generated chunk/s.

Try editing this code:
Code:
 for (var x:int=0; x< s; x )
{
for (var z:int = 0; z < s; z )
{
for (var y:int=0; y< height; y )
{

chunk[x,y,z]=1;

}
}
}

We can change this code in a variety of ways to make a variety of shapes!

Sphere

Code:
 for (var x:int=0; x< s; x++)
{
for (var z:int = 0; z < s; z++)
{
for (var y:int=0; y< height; y++)
{
if(Mathf.Sqrt((x-s/2)*(x-s/2) + (y-s/2)*(y-s/2) + (z-s/2)*(z-s/2)) <= s/2)
{
chunk[x,y,z]=1;
}

}
}
}



Staircase Thing

Code:
 

for (var x:int=0; x< s; x++)
{
for (var z:int = 0; z < s; z++)
{
var height = x;
for (var y:int=0; y< height; y++)
{
chunk[x,y,z]=1;
}
}
}




Interesting shape

Code:
for (var x:int=0; x< s; x++)
{
for (var z:int = 0; z < s; z++)
{
var height = (z)^x;
for (var y:int=0; y< height; y++)
{
chunk[x,y,z]=1;
}
}
}




All located here (You Have to Download the Webplayer folder in each, sorry google drive problem :/ ): https://docs.google.com/folder/d/0BxQ0pDdxhEEZc1JLc2k5RjBJMVE/edit

Post your formulas for weird shapes below Smile


Last edited by Myhijim on Sat Oct 20, 2012 12:56 am; edited 6 times in total (Reason for editing : Grammar)
Back to top Go down
View user profile http://coredev.makingforum.com
Share this post on: Excite BookmarksDiggRedditDel.icio.usGoogleLiveSlashdotNetscapeTechnoratiStumbleUponNewsvineFurlYahooSmarking

Chapter One Review And Examples(Webplayers Too!) :: Comments

No Comment.
 

Chapter One Review And Examples(Webplayers Too!)

View previous topic View next topic Back to top 

Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: Project Civil :: Voxel Engine Development Blog-
Jump to: