Popular Content

Showing content with the highest reputation on 08/07/2016 in all areas

  1. 2 points

    pickWithRay angle

  2. 1 point

    Cylinder-based Physics Wheels

    Hiya! Your main problem is the way the engines are dealing with initial rotation and the fact that a cylinder is facing up per default. There are, as always two ways to solve this. The easy way, or the hard way. (Or better yet the easy way or the right way ) Th easy way would be to say - actually, you are right. wheels are not spheres. But it seems like using a sphere impostor works well. Why won't I "simulate" the wheels using cylinders, but continue using the sphere impostor? Easy. Has down sides of course. But here is how you can achieve that - http://www.babylonjs-playground.com/#IIIVB#3 The hard way is.... well... harder if you want to use cannon's Rigid vehicle - http://www.babylonjs-playground.com/#IIIVB#2 , this is a start. you will notice that everything is kind'a flipped. the front wheels are the side wheels, etc' etc'. You will need to adjust that and actually make a few changes to the cannon class for it to work. I am terribly sorry, but I don't have time to start fixing your oimo demo (which is a modified version of an old car demo I did.). When I'll have the time I'll try finding the best way to solve this with oimo.
  3. 1 point

    Physic with camera not working

    Hi Smatt, to your last question - the engines work iteratively. Each iteration improves the result of the next step. Oimo's default is 10, but I find that it handles joints/constraints better with a higher number of iterations. I usually set 100 as the initial number and lower it until I get satisfactory results. A note (that should be clear ) - the more iterations, the longer it takes to calculate. 1) The collision does work. But updating the camera's position (and thus the box's position) "forces" the box to get into the other box. try moving slowly and you will notice you can't really walk into the crate. Or try looking down and moving forward, you will go through the floor. This is the down-side of position updating (as opposed to the physics engine calculating your position). 2) Calculating the direction is rather simple, it is the vector that goes from the camera's position and its target. 5) Again, I would recommend doing that if you need quick and stable results. It will take some time if you want the camera to be fully controlled by the physics engine.
  4. 1 point
    Tom Atom

    re-use state for different maps

    Hi, when you call game.state.start, you can add multiple optional parameters: game.state.start("Mystate", true, false, param1, param2); These parameters are then passed to init() method, if you have any in your state (init is called as first before create()). With this, you can pass variables from state to state. You can still combine it with inheritance solution and have cleaner code.
  5. 1 point

    Terre en 3D

    Thank you very much ! It works however the polygon mesh with triangulation and the extruded mesh with extrusion haven't the same reference. I had to make a rotation and invert a coordinate (to make a mirror effect). See in attachment. Thanks again for your help !
  6. 1 point

    re-use state for different maps

    You could use class inheritance. So call your main game state MainState, and then each other state would extend MainState. Something like: State 1 extends MainState { create() { // add your custom tilemap here super.create() } } This syntax is using es6 fyi. Hope this helps.
  7. 1 point

    Semi transparent mesh problem

    @adam yep: http://www.babylonjs-playground.com/#DXHFD#6
  8. 1 point


    Wow, cool code from BOTH @Saafine and @Nabroski... just that quick. Nice, you guys! Look at that debris in Nab's render loop: i % 24 == 0 ?(g[a].material = material, g[a].rotation.y += 3, g[a++].rotation.y -= .3) : (a == 10 ? a = 0 : !0), i++ Wow! It almost looks like regexp. (droooool) If I could code like that, I'd be somebody.
  9. 1 point


    Great game and level of polish. It's really addicting.
  10. 1 point
    No problem ; ) I assume you have shadow shapes that you can draw using semi-transparent Graphics. I see 2 ways: 1.Patch Graphics/BlendModeManager to use blendFuncSeparate instead of blendFunc when drawing the shadows, pass gl.ZERO, gl.ONE as 3rd and 4th arguments. 2.Make a filter that replaces shadow-only pixels with transparency. You can modify ColorReplaceFilter(to take alpha into account). Not as efficient as #1 but will do the job.
  11. 1 point

    Coming from Unity, a few questions

    If i may add one tiny note to this, All game frameworks/engines have a sort of renderLoop, wether it is using webGl, DirectX or something else, the rendering is essentially drawing what you can see, so a frame is actually a picture drawn on your screen. every single on-the-go visible change is possible because of this, so let's say you are controlling a player and moving forward, at a standard 60 FPS, it means that the renderLoop draws you 60 frames each second that passes, each frame a little different and it basicly turns code into visual movements infront of your eyes ,
  12. 1 point


    Sorry I had completely lost track of this. Just tried again, works perfectly now.
  13. 1 point
    Goblet Ed


    Great game! Details like the fishes, the sparks from the fire and the moving plants make it extremely polished. I like your small gameplay changes. It's always interesting when classic board games get converted into digital games and developers make UX changes to make the game different / better in ways.
  14. 1 point
    Hi, here is Typescript skeleton I use - each state has its own class (and file). Use types - this is one great thing Typescript gives you: it helps you to find errors and prevents you from doing them: // -------------------------------------------------------------------------// -------------------------------------------------------------------------// -------------------------------------------------------------------------window.onload = () => { new MyGame.Game();};// -------------------------------------------------------------------------// -------------------------------------------------------------------------// -------------------------------------------------------------------------module MyGame { export class Game extends Phaser.Game { // ------------------------------------------------------------------------- constructor() { // init game super(800, 480, Phaser.AUTO, "content", null /* , transparent, antialias, physicsConfig */); // states this.state.add("Boot", Boot); this.state.add("Preloader", Preloader); this.state.add("Menu", Menu); this.state.add("Levels", Levels); this.state.add("Play", Play); // start this.state.start("Boot"); } }}// -------------------------------------------------------------------------// -------------------------------------------------------------------------// -------------------------------------------------------------------------module MyGame { export class Boot extends Phaser.State { // ------------------------------------------------------------------------- constructor() { super(); : : } // ------------------------------------------------------------------------- init() { if (this.game.device.desktop) { : : } else { : : } } // ------------------------------------------------------------------------- preload() { : : } // ------------------------------------------------------------------------- create() { : : } // ------------------------------------------------------------------------- update() { : : } }}// same classes for other game states like "Boot" class (... usually without init() method)Look at my small tutorial for simple Phaser Typescript game here: http://sbcgamesdev.blogspot.cz/2015/05/phaser-tutorial-dronshooter-simple-game_23.html