Click here to Skip to main content
15,671,955 members
Home / Discussions / C#
   

C#

 
GeneralRe: Central Windows Application Authentication Pin
Zeyad Jalil22-Nov-13 1:15
professionalZeyad Jalil22-Nov-13 1:15 
GeneralRe: Central Windows Application Authentication Pin
Pete O'Hanlon22-Nov-13 1:16
subeditorPete O'Hanlon22-Nov-13 1:16 
AnswerRe: Central Windows Application Authentication Pin
WuRunZhe22-Nov-13 3:00
WuRunZhe22-Nov-13 3:00 
GeneralRe: Central Windows Application Authentication Pin
Zeyad Jalil22-Nov-13 4:26
professionalZeyad Jalil22-Nov-13 4:26 
AnswerRe: Central Windows Application Authentication Pin
Dave Kreskowiak22-Nov-13 6:18
mveDave Kreskowiak22-Nov-13 6:18 
GeneralRe: Central Windows Application Authentication Pin
Eddy Vluggen22-Nov-13 7:05
professionalEddy Vluggen22-Nov-13 7:05 
GeneralRe: Central Windows Application Authentication Pin
Dave Kreskowiak22-Nov-13 12:38
mveDave Kreskowiak22-Nov-13 12:38 
QuestionNeed help with creating a cube mesh in Unity3D C# Pin
begginerc221-Nov-13 18:21
begginerc221-Nov-13 18:21 
Hello all,
Im trying to learn on how to create a cube mesh via coding. Yet i seem to be stuck at making it.

This is what i got right now..
C#
for(int i = 0; i < xSize; i++){
			for(int y = 0; y < ySize; y++){
				for(int j = 0; j < zSize;j++){
					
					GenerateSphere(i * seperationX,y * seperationY, j*seperationZ);
					newVertices[ConvertToArrayIndex(i,j,xSize)] = new Vector3(i * seperationX, y * seperationY,j * seperationZ);
					//newNormals[ConvertToArrayIndex(i,j,xSize)] = new Vector3(0,1,0);
					//newUV[ConvertToArrayIndex(i,j,xSize)] = new Vector2(i * seperationX / (xSize - 1),j * seperationZ / (zSize - 1));
					Debug.Log (ConvertToArrayIndex(i,y,xSize));
					//Debug.Log (ConvertToArrayIndex(i,j,xSize));
					int counter = 0;
					if((i < xSize - 1) && y < (ySize - 1) && j < (zSize - 1)) {
						newTriangles[counter] = ConvertToArrayIndex(i,j,xSize);
						counter++;
						newTriangles[counter] = ConvertToArrayIndex(i ,j + 1,xSize);
						counter++;
						newTriangles[counter] = ConvertToArrayIndex(i + 1,j,xSize);
						counter++;
						newTriangles[counter] = ConvertToArrayIndex(i+ 1 ,j+1,xSize);
						counter++;
						newTriangles[counter] = ConvertToArrayIndex(i + 1,j,xSize);
						counter++;
						newTriangles[counter] = ConvertToArrayIndex(i,j + 1,xSize);				
						counter++;
						/*newTriangles[counter] = ConvertToArrayIndex(i,y,ySize);
						counter++;
						newTriangles[counter] = ConvertToArrayIndex(i ,y+1,xSize);
						counter++;
						newTriangles[counter] = ConvertToArrayIndex(i + 2,y,xSize);
						counter++;
						newTriangles[counter] = ConvertToArrayIndex(i+3,y,xSize);
						counter++;*/


					}
				}
			}
		}
		
		myMesh.vertices = newVertices;
		myMesh.triangles = newTriangles;
		//myMesh.normals = newNormals;
		//myMesh.uv = newUV;
		GetComponent<MeshFilter>().mesh = myMesh;
	}
	
	
	void GenerateSphere(float x,float y,float z){	
		GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
		sphere.transform.localPosition = new Vector3(x,y,z);
		sphere.transform.localScale = new Vector3(0.1f,0.1f,0.1f)	;
	}
	
	int ConvertToArrayIndex(int i, int j, int size){
		return j +size * i;		
	}


I just need help, its not a homework or anything please.. Im just confused on how to continue..
SuggestionRe: Need help with creating a cube mesh in Unity3D C# Pin
Richard MacCutchan21-Nov-13 22:05
mveRichard MacCutchan21-Nov-13 22:05 
QuestionHow get paragraph Format text of Pdf or docx Pin
dddddddddd21-Nov-13 9:29
dddddddddd21-Nov-13 9:29 
AnswerRe: How get paragraph Format text of Pdf or docx Pin
Richard MacCutchan21-Nov-13 22:03
mveRichard MacCutchan21-Nov-13 22:03 
GeneralRe: How get paragraph Format text of Pdf or docx Pin
Richard Deeming22-Nov-13 1:46
mveRichard Deeming22-Nov-13 1:46 
Questiondifference between System and Object class Pin
Member 996561421-Nov-13 9:11
Member 996561421-Nov-13 9:11 
AnswerRe: difference between System and Object class Pin
Ron Beyer21-Nov-13 11:54
professionalRon Beyer21-Nov-13 11:54 
AnswerRe: difference between System and Object class Pin
Abhinav S21-Nov-13 16:08
Abhinav S21-Nov-13 16:08 
QuestionHow get paragraph FontName with Docx dll? Pin
dddddddddd21-Nov-13 9:07
dddddddddd21-Nov-13 9:07 
AnswerRe: How get paragraph FontName with Docx dll? Pin
Dave Kreskowiak21-Nov-13 16:50
mveDave Kreskowiak21-Nov-13 16:50 
QuestionDataGrid binding at runtime (WPF) Pin
Julio Kuplinsky21-Nov-13 5:45
Julio Kuplinsky21-Nov-13 5:45 
AnswerRe: DataGrid binding at runtime (WPF) Pin
Abhinav S21-Nov-13 6:20
Abhinav S21-Nov-13 6:20 
GeneralRe: DataGrid binding at runtime (WPF) Pin
Julio Kuplinsky21-Nov-13 9:04
Julio Kuplinsky21-Nov-13 9:04 
Question64 bit Microsoft Direct X Dll Pin
himanshu_aroh21-Nov-13 1:00
himanshu_aroh21-Nov-13 1:00 
AnswerRe: 64 bit Microsoft Direct X Dll Pin
Dave Kreskowiak21-Nov-13 2:36
mveDave Kreskowiak21-Nov-13 2:36 
GeneralRe: 64 bit Microsoft Direct X Dll Pin
himanshu_aroh21-Nov-13 2:57
himanshu_aroh21-Nov-13 2:57 
GeneralRe: 64 bit Microsoft Direct X Dll Pin
Dave Kreskowiak21-Nov-13 5:56
mveDave Kreskowiak21-Nov-13 5:56 
GeneralRe: 64 bit Microsoft Direct X Dll Pin
harold aptroot21-Nov-13 3:55
harold aptroot21-Nov-13 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.