Bash Posted October 17, 2017 Share Posted October 17, 2017 I'm a newbie to the 3d dev world... WOW, the learning curve is HUGE! At any rate, I thought I would give Babylon.js a shot... I watched the learning series on Microsoft Virtual Academy with the two David's... In the materials example they show an example of creating 10 spheres in a circle surrounding a single sphere... That was the start of a simple idea I wanted to implement on a home page... I would like to create a wheel of objects that a user could spin... and a random object would stop center screen showing the result of the spin... I want a vertical spinning series of objects... Not like a money wheel or vertical roulette wheel, but more like a slot machine wheel, or think "the price is right wheel", where players spin the wheel to get closest to $1... My layout is very basic, and I simply need some assistance with how to go about animating something with physics... i.e. make the wheel look random and look realistic. Most of the examples I find show creation of scenes and objects, and perhaps some basic animation, but to create a game seems like it would be a huge undertaking. Assets (meshes) not withstanding, game logic seems like... well... formidable! I would also like some assistance with game code organization... Is there documentation on a logical order to store scripts and assets? * things I've determined from trial an error... The number of points should be evenly divisible by 360 in order for an object to be centered center screen... In this example the number of objects is 24, and the radius is 3... This centers an object center screen... If I use 16, and a radius of two this will also work for my needs... Now I would like to animate the spinning of this "wheel of objects", and have some sort of physics working to make the experience realistic... var createScene = function () { var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color3(0, 0, 0); var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 0, -6), scene); camera.setTarget(BABYLON.Vector3.Zero()); camera.attachControl(canvas, false); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 0, 0), scene); var points = 24; var radius = 3; var slice = (2 * Math.PI) / points; for (var i = 0; i < points; i++) { angle = slice * i; var obj = BABYLON.Mesh.CreateBox("box" + i, .65, scene); obj.position.y = (0 + radius * Math.cos(angle)); obj.position.x = -1; obj.position.z = (0 + radius * Math.sin(angle)); } return scene } Quote Link to comment Share on other sites More sharing options...
jerome Posted October 17, 2017 Share Posted October 17, 2017 Please ask your questions in the "Questions & Answers" section and please do a PG to help us to help you Quote Link to comment Share on other sites More sharing options...
Raggar Posted October 17, 2017 Share Posted October 17, 2017 I'm not too happy about this, but it's something: http://playground.babylonjs.com/#QXKTNJ I like the idea of having physics do it, though. Take a look at compound shapes and maybe hinge joints for the top pin thingy. Should be doable. 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.