• Content count

  • Joined

  • Last visited

  • Days Won


JohnK last won the day on August 8

JohnK had the most liked content!


About JohnK

  • Rank
    Advanced Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    England, Buckinghamshire

Recent Profile Visitors

4,843 profile views
  1. Will have a go at the maths and line drawing part and will leave GUI to you or somebody else. Will set it up so that parameters are easy to transfer to GUI.
  2. JohnK

    collision detection with holes

    Here is a minor development - currently it is restricted to the sphere moving in the y direction and the plane of the item must be perpendicular the Y axis. You could extend it to other shaped holes but would need to use the inscribed circle of the shape as the hole boundary. I have also simplified to one hole and everything centered on the origin. You can soon extend. The idea is that provided the sphere is smaller than the hole it will go through if the centre of the sphere is close enough to the centre of the hole. I think the code is self explanatory but if you need something explaining please ask. Have fun. Adjust line 51 for sphere not the pass through. This one is just playing around with a reaction if the sphere cannot get through. It is not very good as the reaction is not what you would expect. To get a better reaction you would need to determine the position of the sphere's central column to the centre of the hole.
  3. JohnK

    collision detection with holes

    Hi @SchneeHenry and a welcome from me. Actually they do overlap. It is a little easier to see from this angle and even easier to see if you do as @Wingnut suggests and show the bounding boxes for the sphere and cylinderHole Top. You need to check your measurements and also remember that an intersection is calculated from a bounding box. You collision cylinder has a diameter of 2.25 * 0.05 = 0.1125 and so a radius of 0.02625, so looking down onto the XZ plane gives the following results the bottom edge of your collision cylinder is at -1.72625 but the top edge of the sphere is at -1.6 . Also the left edge of the collider is at -0.02625 whereas the right edge of the sphere is at 0. When R is the radius of the sphere for them not to intersect you need -2.1 + R < -1.72625 R < 2.1 - 1.72625 R < 0.47375 and so the diameter of the sphere has to be less than 2R = 0.9465 In practice (either due to my error somewhere in calculations or to rounding errors) max radius is 0.88 as you can see in this
  4. Came across this stackExchange article which deals with distributing points equally along a Bezier curve. Would need a little adaptation but could help.
  5. JohnK

    Quaternion to euler angles

    Hi @Seba and welcome to the forum from me. It is because converting from quaternion to Euler Angles is not done using a 1 to 1 mapping. Take the simple equation y = x2 , this is not 1 to 1 since both 2 and -2 lead to the same result, the function Math.sqrt(4) has to be written to give a result and the convention calculate and return the positive square root is used. It is the same with rotations. Take this cube ( all rotations given in degrees) and rotate using the Euler Angles (0, 0, 90) to give Starting with the same cube rotate using the Euler Angles (180, 180, 270) first rotate 180 about the local Y axis followed by a rotation of 180 about the local X axis to give and finally a rotation of 270 about the local Z axis to give So the Euler angles (0, 0, 90) and (180, 180, 270) give the same orientation to the box. Reversing this says given the that this box was rotated to this orientation what are the Euler angles that produce this orientation? As there are more than one answer any algorithm to find the Euler angles must use some convention to produce a result. As you can see from this playground your Euler angles of (91, 0, 0) and (89, 180, 180) produce the same orientation and it just happens that the convention used by the toEulerAngles function produces the second result. Hope all is now explained.
  6. JohnK

    Quaternion to euler angles

    You have probably already read this but in case you have not
  7. Well done Wingy, with two thumbs I get translation and rotation at the same time on my Motorola E4 with Android 7.1.1 and on my little old tablet with Android 5.1😄
  8. CSG (Constructive Solid Geometry) deals with adding, and subtracting two meshes and must deal with their intersection. So there must be something in the code for this that will help you.
  9. See if this helps
  10. JohnK

    Spot Light Cone

    Bit of a cheat and the light still gives a circular spread but you do get a rectangle of light
  11. JohnK

    From AbstractMesh to Mesh

    My suggestion to get more help would be edit your first post and change your title to better reflect your issue. Something like imported stl file not converting to CSG
  12. JohnK

    From AbstractMesh to Mesh

    In that case have you checked that the box and your model intersect. Actually the first step is to check your model loads. Do you get the same error messages if you only load the file? See you are using an STL model, have you read this If you have read and done this I cannot help as I do not work very much with loaded files. Could also be an error in your file.
  13. JohnK

    CSG in Babylon

    So you need dynamic subtraction of multiple meshes. Have you tried CSG with invisible meshes? That way you might get way with just disposing of and re-creating the CSG and mesh from CSG each frame. By the way personally I would ask a new question rather than adding to this topic which is a really a demo thread. I would show the video and ask the question anew. Up to you of course. 😊
  14. @Deltakosh am working on a PG that uses a GUI to choose material color rather than showing all four at once. Should be ready in about half an hour and I will update docs with it then, if OK with you.