Jump to content

Babylon.js October Challenge - We'll build a maze!


RaananW
 Share

Recommended Posts

Wanna see a GREAT maze that Deltakosh made?

 

https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.mesh.js#L1802

 

Yep, mesh.CreateDecal!  It takes a serious explorer to navigate THAT puppy :)

 

Hey, one can implement this function in its maze, to help people finding the way ! "pshiit" a decal on the wall, and you'll see if you've been there already :)

Link to comment
Share on other sites

:)  I think mirrors could be trouble.  Then, maybe you find out... that the character you are playing... is actually a section of wall... which has come alive and is trying to find a way to escape all his welded-in-place brethren.  :D  Wow.  As you walk up to a wall mirror... it appears you are walking-up to a brick wall, but it was really YOU walking-up to the mirror.  Or something like that.  Or not. 

Link to comment
Share on other sites

My maze is already so cool, I think I have to show it even before the end of October :D I still have two bugs that keep... bugging me (get it? ;) )... not sure if I should try to recreate them in the playground without showing too much of my maze or if I should just post the whole maze so you can see the problems... :-/

Link to comment
Share on other sites

Has anything changed with the playground in the last 12 hours? In my maze I had a tube created with the original method and it appeared OK last night but this morning the tube is no longer shown. My code still works locally with the BJS2.2 version I had downloaded. :wacko:

Link to comment
Share on other sites

@Jaskar - First PM received!! Awesome!!

 

@John - Can you create a playground with the tube only? Maybe we can debug it together? The MeshBuilder was introduced, but the new version is backwards compatible. was works in 2.2 should work in 2.3 as well.

 

@iiceman - just show us, we are not that bad! :-)

Link to comment
Share on other sites

Ok, problem found. The MeshBuilder is missing the arc default value. I'll commit a fix, no idea when the playground will work again.

 

You can always start using the new way of creating the meshes using the mesh builder, this will solve the problem in the playground... like this - http://www.babylonjs-playground.com/#Q6CI#2

Link to comment
Share on other sites

Well, I am not afraid that you "steal" my idea or something...you guys have always such great ideas and do way cooler stuff anyways. I was just afraid I ruin the surprise or something :P

 

This is the current version of my maze: http://p215008.mittwaldserver.info/Maze/ It is inspired by the classic game "decent": https://en.wikipedia.org/wiki/Descent_(video_game)

 

"M" toggles the map. Later the map will only be available at certain points in the maze. The violet gate is the exit, the green bouncy ball could be an enemy :P

 

Bugging me 1: the flash light is flickering sometimes when moving around corners..it's just not as smooth as I imagined... but maybe that's just how it is.

 

Bugging me 2: When you fly to the ground it's all cool. But if you fly to the ceiling somehow the camera goes trough. I tried adjusting the ellipsoid but I only get more distance to the ground but not the to the ceiling. There doesn't seem to be an ellipsoid offset for the camera, right? So not sure why that is happening, if anybody has an idea I would appreciate any hint. I can try to recreate it in the playground if that helps.

Link to comment
Share on other sites

// ADD ENEMIES// TODO enemy movement - chase player? dodge? 

iiceman, should we be afraid?

 

The map, the maze, so cool!

 

About the flashlight - I actually thought it was a part of your design, I would simply leave it this way :-) But no idea why it is flickering from time to time.

 

About the camera - I remember having the same problem. I think it is due to the ellipsoid not being the center of the camera, but its center of mass (This - the camera is your eyes, but the ellipsoid is actually the middle of your torso). I guess a larger ellipsoid didn't work. I sovled it somehow back then, but i forgot how. Perfect... I will try finding the code and let you know.

Link to comment
Share on other sites

Yes you should be afraid :D but not sure if I can finish it in time, but I'll try!

 

Yeah, I guess that flickering ain't that bad, maybe I really leave it.

 

About the camera: larger ellipsoid only helps with the bottom, didn't help with the top. Would be awesome if you find that code. Maybe some offset value just like it's for the abstract mesh ellipsoid would be useful for the camera, too?

Link to comment
Share on other sites

@RaananW: did you have time to look for your code for fixing the ellipsoid yet?

 

I think I found a way to get what I want for the camera by overwriting the _collideWithWorld method:

        var cameraOffsetY = 0.5;	camera._collideWithWorld = function (velocity) {		var globalPosition;		if (this.parent) {			globalPosition = BABYLON.Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());		}		else {			globalPosition = this.position;		}		globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y - cameraOffsetY, 0, this._oldPosition);		this._collider.radius = this.ellipsoid;		//no need for clone, as long as gravity is not on.		var actualVelocity = velocity;		//add gravity to the velocity to prevent the dual-collision checking		if (this.applyGravity) {			//this prevents mending with cameraDirection, a global variable of the free camera class.			actualVelocity = velocity.add(this.getScene().gravity);		}		this.getScene().collisionCoordinator.getNewPosition(this._oldPosition, actualVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);	};

Not sure if that's good practice, though. Maybe this is my chance to do the tiniest contribution ever if I create a pull request for such an offset value? Well, maybe after I figured out how to set up a TypeScript environment :P So if anybody else thinks this is a good idea: don't wait for me, take all the glory for yourself and create a PR ;)

Link to comment
Share on other sites

I'm trying to use the new CreateTube Mesh but it doesn't quite look right :( http://puu.sh/kTrOH/0a47b2c439.jpg

 

 

I can't do a playground test right now but here's my rough idea(yes I borrowed the texture example from a similar thing that John was doing)

 

I'm not sure the tube is going to work the way I want it to, does anyone have suggestions on what might be a better thing to use? I was hoping to use like a cube and just remove the sides but I imagine it's not that simple.

                if (type == Box.TYPES.FORWARD) {                    level.paths.push(new BABYLON.Vector3(level.paths[level.paths.length - 1].x, 0, level.paths[level.paths.length - 1].z + 1));                } else if (type == Box.TYPES.RIGHT) {                    level.paths.push(new BABYLON.Vector3(level.paths[level.paths.length - 1].x + 1, 0, level.paths[level.paths.length - 1].z));                } else if (type == Box.TYPES.BACKWARD) {                    level.paths.push(new BABYLON.Vector3(level.paths[level.paths.length - 1].x, 0, level.paths[level.paths.length - 1].z - 1));                } else if (type == Box.TYPES.LEFT) {                    level.paths.push(new BABYLON.Vector3(level.paths[level.paths.length - 1].x - 1, 0, level.paths[level.paths.length - 1].z));                }    var tube = BABYLON.MeshBuilder.CreateTube("tube", { path: level.paths, radius: 1.5, tessellation: 4, arc: 1 }, level.game.scene);    material = new BABYLON.StandardMaterial("cmat", level.game.scene);    material.diffuseTexture = new BABYLON.Texture("http://cubees.github.io/images/wire.jpg", level.game.scene);    material.backFaceCulling = false;    tube.material = material;    tube.rotation.x = Math.PI / 4;
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...