JohnK

Members
  • Content Count

    1,357
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by JohnK

  1. For no good reason I was thinking about physics engines and came across this. As I was looking for a new challenge I took a look and as BitOfGold said the API is horrible but though I would give it a go. I took this example and had a go at making it work with Babylon. Never having worked with 'workers' before I had a go at doing a test with a direct implementation with Babylon.js which is here and if anyone is interested the code is at github. Very early days but slowly over the next year I will have a go at seeing what is possible and if getting somewhere will see whether it would make a good extension with added documentation. As a very amateur coder however I have a lot to learn for example how do I use ammo.js without enclosing everything in Ammo().then(function(Ammo) { }) Anyone else interested in seeing what is possible with Ammo.js and Babylon.js the let me know.
  2. Now PRed to Babylon.js Docs
  3. JohnK

    Wikipedia

    https://en.m.wikipedia.org/wiki/BabylonJS
  4. You can build your own custom version. The only way I could do it I will describe below. Others may know alternatives You build from a local version of the BabylonJS/Babylon.js github repository. Read https://doc.babylonjs.com/how_to/how_to_start and rather than creating your own fork and cloning from that just clone directly to your local computer. Before doing the build part read https://doc.babylonjs.com/how_to/workloads to see which workloads to select and place in the `buildConfigurations` and set the `currentConfig` to this. The do the build part with gulp --max-old-space-size=8192 and you build of javascript files will be in the dist folder.
  5. JohnK

    Wikipedia

    Have renamed page to Babylon.js to match French and Russian versions BabylonJS will redirect
  6. JohnK

    How add ring in disc?

    Sorry do not know what you mean please explain.
  7. JohnK

    Mesh generation with a points

    Hi @Brabbit_640 welcome to the forum for point rendering this thread is also worth a read mesh building possible provided, as trevordev said, you know how to triangulate (if that's the right word) the points.
  8. JohnK

    Typo on Doc

    Thank you for the info, corrected and PRed
  9. JohnK

    Cylinder edit vertices on top

    But if it is on a different topic then as you have done asking a new question is better.
  10. Still seems to be a little misunderstanding. This is the forum. The playground is a great place where you can write or paste code that can be edited and the effects seen immediately. @Wingnut gave you a link to a playground he created for you https://playground.babylonjs.com/#2A3BE8#5 it is very simple for you (or anyone else) to make changes and hit the Run button to see the effect of these changes. Keep making changes and hit that Run button 'til you get to a point where you need more help. Just hit the Save button. The playground you were editing is still safe - the new playground will have a number (after the #) one higher than the one you were playing with. Copy the address of your new playground and paste this straight into the forum. Now we can help by editing this playground, saving it and pasting the link for you to see what we have done. To get back to an earlier playground you were working with just change the number after # to a lower one. It can also be a good idea to bookmark for your self any playgrounds you might want to go back to as it is not easy to remember which number between the two #s goes with which playground. When you want a blank playground the new button will give you a starter template nd clear will give you a completely blank playground. For now have a play around with the playground Wingy posted see what you can achieve towards your goal and then ask more questions.
  11. JohnK

    How add ring in disc?

    You could build with 'cones' adjusting top and bottom diameters, heights and positions https://www.babylonjs-playground.com/#B0I6G3#1
  12. JohnK

    How add ring in disc?

    Given you have named your disc disco how about https://www.babylonjs-playground.com/#S7HM64#4 😎
  13. Hi @Eisha and welcome to the forum from me. Rather than providing a zip file which requires down loading, virus checking and running it would be so much easier to help you if you gave us a simple playground with two spheres and the code you are using. If your code has been set up using a createScene function it is easy to transfer this part to the playground. You can see the relationship between your own HTML code and playground code here https://doc.babylonjs.com/babylon101/first Before you create the playground for us this page may be helpful https://doc.babylonjs.com/snippets/issues. It deals with a sphere hitting a wall but the issues are the same.
  14. Hi @Beny and welcome to the forum. Really glad you are enjoying your first steps with Babylon.js. You have mentioned in both your topics that you are creating a 2D game and as much as I love Babylon.js I would ask you to take a step back and consider using a 2D games engine such as phaser or pixi.js both of which have forums on this site. It seems that from your questions that you are imagining the game in 2D and this will make it dfficult to build it with a 3D engine such as Babylon.js
  15. JohnK

    Adding a Roof to a House Built from Plans

    Been busy recently so sorry for the delay. You need to be able to understand the data structure of a mesh and particularly for the UV part https://doc.babylonjs.com/how_to/custom#calculating-uvs If you state a couple of lines at a time that give you the most problem we can work through code a bit at a time.
  16. JohnK

    Build a House from a Floorplan

    How much trigonometry and vectors do you know? 6 walls 0,1,2,3,4,5 x % 6 means x modulo 6 ie remainder when x is divded by 6 Walls join 0-1-2-3-4-5-0 get by adding 1 each time 5+1=6 Divide 6 by 6 remainder is 0 and (5+1)%6=0
  17. Hi @rans0000 and welcome to the forum. You might find this useful https://doc.babylonjs.com/resources/offsite_tutorials_list
  18. JohnK

    Fitting Objects Question

    Possibly don't think hair + hood think headware So headware can be hair or can be a hood. Put on a hood relace headware hair with headware hood?
  19. JohnK

    Build a House from a Floorplan

    Indices explained https://doc.babylonjs.com/how_to/custom#positions-and-indices
  20. Is this of any help? https://doc.babylonjs.com/babylon101/cameras#flycamera
  21. JohnK

    Build a House from a Floorplan

    In this image the blue walls are the inner walls and the red ones the outer walls, the position vectors ai, bi, ci are known and hence so will line L = bi - ai and next line N = ci - bi. We need to find the position vector of bo. Knowing the distance between the inner and outer wall we can use the right angled triangles (as shown) to determine bo. Using the vector dot product angle = Math.acos(BABYLON.Vector3.Dot(line, nextLine)/(line.length() * nextLine.length())); we can determine the angle between L and N. However that angle can be acute (left hand image), obtuse or reflex (right hand image) whereas the Math.acos returns an angle between 0 and PI. Using the cross product direction = BABYLON.Vector3.Cross(nextLine, line).normalize().y; will give a vector perpendicular to L and N ie of the form (0, y, 0) and normalizing will give (0, 1, 0) or (0, -1, 0) depending whether the angle is reflex or not. We need to find out the unit vector perpendicular to L (forms the right angle in the images). Since taking the dot product of (x1, y1, z1) with (x2, y2, z2) gives x1x2 + y1y2 + z1z2 which will be zero when the two vectors are perpendicular then for L = (x, 0, z) the perpendicular (or normal line) to L in the plane LN will have the form (-z, 0, x) as these give a dot product of zero. Hence lineNormal = new BABYLON.Vector3(line.z, 0, -1 * line.x).normalize(); The we need the unit vector in the direction of L line.normalize(); Current ai tells us we are at wall w and bo is for wall w + 1. Since the walls are closed at the end wall w + 1 = 0. Hence the need to work modulo the number of walls (w + 1) % nbWalls Now we can use the right angled triangle to determine the position vector of bo. Starting from bi (corner of wall w + 1 mod nbWalls) travel along base and along height to get to bo (vector addition is commutative so can add in opposite order) as below Walls] = walls[(w + 1) % nbWalls].corner.add(lineNormal.scale(ply)).add(line.scale(direction * ply/Math.tan(angle/2))); remember ply is distance between inner and outer wall so vector along height is scaled by ply. Knowing ply and the angle we can use tan to get the base length. Multiplying by direction deals with when angle is reflex or not. we can then move on to the next line along line = nextLine.clone(); and find the next line. Note we are using subtractToRef V.subtractToRef(W, R) which takes W from V and puts the result into R walls[(w + 3) % nbWalls].corner.subtractToRef(walls[(w + 2) % nbWalls].corner, nextLine); note that as ai is wall w, bi is wall w + 1 and ci is wall w + 2 Hope that helps
  22. JohnK

    Finish Line Block

    @bghgary neat solution. I was going for adding instances. https://www.babylonjs-playground.com/#20OAV9#373 More on faceUV https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors#how-to-apply-faceuv-and-facecolors-examples
  23. JohnK

    Car track

    Sorry in my example #3 and your example #48 the meshes are not getting disposed and are building up. The variable `lines` should be defined once as a var and reused. Ccorrected version https://www.babylonjs-playground.com/#SSZ2IM#5
  24. JohnK

    Car track

    Every time the car moves you are creating a new line2D mesh. What looks like one track are layers of many tracks. A simple way to void this is to dispose of the previous track before creating the next one https://www.babylonjs-playground.com/#SSZ2IM#3
  25. JohnK

    Car track

    Only partly. originally you had new BABYLON.Vector3(sphere.position.x, sphere.position.y, sphere.position.z) a quick way of getting the same is sphere.position.clone() So why `.getAbsolutePosition()`? Line 156 attaches the sphere to the carBody sphere.parent = carBody; This means that sphere.position will always be its position relative to the carBody and so never changes. To get the world position of the sphere you need to use sphere.getAbsolutePosition() and hence points_track.push(sphere.getAbsolutePosition().clone()); You could get the same result with points_track.push(new BABYLON.Vector3(sphere.getAbsolutePosition().x, sphere.getAbsolutePosition().y, sphere.getAbsolutePosition().z));