JohnK

Members
  • Content count

    854
  • Joined

  • Last visited

  • Days Won

    16

JohnK last won the day on December 4

JohnK had the most liked content!

1 Follower

About JohnK

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    http://babylonjsguide.github.io/

Profile Information

  • Gender
    Male
  • Location
    England, Buckinghamshire

Recent Profile Visitors

3,507 profile views
  1. Is this still the allowJump problem. If I understand you correctly you only want a jump action possible if the "character" or "camera as character" is in contact with an object, for example the ground. So you want If character in collision allowJump = true If character exits collision allowJump = false
  2. Pivot Problems

    Hi and welcome. You are positioning the sphere using cylinder02.getPivotPoint(); but as you haven't set the pivot point this returns 0 https://playground.babylonjs.com/#RLT22Z#3 Secondly using the developer tools inspection panel in the browser quickly shows these errors in the console ReferenceError: Cylinder01 is not defined ReferenceError: Cylinder02 is not defined You used c for your cylinder variables not C. https://playground.babylonjs.com/#FG1ECQ#1
  3. Have a play with this https://www.babylonjs-playground.com/#7NQA2K#1
  4. Would have appreciated seeing a PG of your first attempt as more than likely it was pretty close to this https://www.babylonjs-playground.com/#3NYWX5#2 and just needed a bit of tweaking .
  5. Hi and welcome to the forum. Here are some stairs using ExtrudePolygon https://www.babylonjs-playground.com/#RNCYVM#34 documentation
  6. Working for me on an Android tabled. Touch away from object which is deselected. Select texture touch object texture changed on object, touch new texture this texture applied to object.
  7. The forum post goes on to say So taking this idea plus this SPS playground https://www.babylonjs-playground.com/#10RCC9 and combining shows 2550 solid particles colliding with a sphere imposter around a camera gives https://www.babylonjs-playground.com/#10RCC9#13 (wait for batch of red particles to go then green particles are fired towards the camera turning red when colliding with the camera imposter and being diverted). This is a quick demo cobbled together to show performance without any attempt at any optimisation. OK you want a camera that moves and (possibly stationary meshes) but this would probably improve performance. Keep trying and I am sure you will get where you want to be.
  8. In this case there are problems in wanting to use internal methods (collisions and falling under gravity) to change an external variable (allowJump) this https://www.babylonjs-playground.com/#UTWLUM is a (poor) attempt to use @Gijs's method of checking for changes in y. One problem is that the gravity and collision methods used seem to change the y of the camera even when moving horizontally. Anyway use the left arrow key to move of the ground and the sphere turns red when falling (but on occasions can do when moving horizontally). With onCollide I can see how allowJump can be set to true but do not see how to set to false when not in collision. Probably needs a notInCollision observable. An alternative is http://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh or to use BABYLON.ActionManager.OnIntersectionEnterTrigger and BABYLON.ActionManager.OnIntersectionExitTrigger in an actionManager Sorry but cannot be of more help. Interesting issue for 3D platform games as well that would need someone more skilled than me.
  9. True but there is no indication that kurlaa is using this method.
  10. How do you know you are no longer on a mesh and so must fall? If you have some logic that says you have moved off a mesh and so activate a fall then when activating the fall also set allowJump to be false.
  11. ExtrudeShapeCustom not working right

    Easiest way is to do what I did in #4 reverse lower/upper (top/Bottom) values https://www.babylonjs-playground.com/#KCFUE2#7
  12. ExtrudeShapeCustom not working right

    Bit trickier than I thought but here it is https://www.babylonjs-playground.com/#KCFUE2#3 but I may have got it upside down so https://www.babylonjs-playground.com/#KCFUE2#4 Note that because your poly data is all positive and scaling is set at the origin the shape is skewed see better with bigger chamfer https://www.babylonjs-playground.com/#KCFUE2#5 If you want to the base centres in alignment then you need to adjust your data to have the origin at the centre https://www.babylonjs-playground.com/#KCFUE2#6
  13. ExtrudeShapeCustom not working right

    As an alternative extrude without caps use createPolygon or PolygonMeshBuilder to make the caps and merge the meshes.
  14. When a wall is created and positioned can you not make the normal a property of the wall. You could also check this out http://doc.babylonjs.com/how_to/how_to_use_facetdata In particular getFacetsAtLocalCoordinates and getFacetNormal EDIT Started this answer a couple of hours ago on my mobile while waiting for an appointment. Finished it when I got home before checking for replies. Answer is probably now redundant.
  15. The fps can vary depending on the number of meshes and other conditions. If you want your mesh to move at a predetermined speed say V units per sec then you need to know how far to move per frame. When the frame rate is F fps then the time taken T for a given frame at that time is 1/F so the distance moved by the mesh is VT = V/F. scene.registerBeforeRender or scene.registerAfterRender can be used to make changes for one frame. So for a mesh with speed V in the direction of the X axis scene.registerBeforeRender (function (){ var F = engine.getFps (); mesh.position.x += V/F; })