JS-KMM Posted June 29, 2016 Share Posted June 29, 2016 I want to set the position for particular ID's.In above my code i have created id for each coins I hae tried var xa = 100; var ya = 5; var za = 25; for(j ; j < (ballcount + 5); j++) { coin[j]; coin[j].id.position = new BABYLON.Vector3(xa, ya, za); coin[j].id.material = coinMaterial; } ballcount = ballcount + 5; if (j < 5) { xa = (xa - (100 / 5)); } else if (j < 10) { xa = (xa - (100 / 7.5)); } else if (j < 15) { xa = (xa - (100 / 6.5)); } else if (j < 20) { xa = (xa - (100 / 5)); } else if (j < 25) { xa = (xa - (100 / 5)); } else if (j < 30) { xa = (xa - (100 / 5)); } else if (j < 35) { xa = (xa - (100 / 5)); } else if (j < 40) { xa = xa + 15; //- (100 / 90)); } else if (j < 45) { xa = (xa - 18); } else if (j < 50) { xa = (xa - 20); } else if (j < 55) { xa = (xa - 18); } else if (j < 60) { xa = (xa - 18); } else if (j < 65) { xa = (xa - 20); } else { xa = (xa - 20); } Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 29, 2016 Share Posted June 29, 2016 hey not sure to understand the question can you create a Playground for it? Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted June 29, 2016 Share Posted June 29, 2016 Where is j set? what is ballcount? Please elaborate. Despite the missing information.. i gave it a go anyway. I don't know if this is what you're looking for, but atleast it's a working piece of code now //Variables. var xa = 100, ya = 5, za = 25; //add 5 to ball count..? ballcount += 5; for(var j = 0; j < ballcount; j++) { //Make dummy variable for xa instead of editing the global xa variable. var xa2; if (j < 5) { xa2 = (xa - (100 / 5)); } else if (j < 10) { xa2 = (xa - (100 / 7.5)); } else if (j < 15) { xa2 = (xa - (100 / 6.5)); } else if (j < 20) { xa2 = (xa - (100 / 5)); } else if (j < 25) { xa2 = (xa - (100 / 5)); } else if (j < 30) { xa2 = (xa - (100 / 5)); } else if (j < 35) { xa2 = (xa - (100 / 5)); } else if (j < 40) { xa2 = xa + 15; //- (100 / 90)); } else if (j < 45) { xa2 = (xa - 18); } else if (j < 50) { xa2 = (xa - 20); } else if (j < 55) { xa2 = (xa - 18); } else if (j < 60) { xa2 = (xa - 18); } else if (j < 65) { xa2 = (xa - 20); } else { xa2 = (xa - 20); } coin[j].id.position = new BABYLON.Vector3(xa2, ya, za); coin[j].id.material = coinMaterial; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.