MackeyK24

Members
  • Content count

    440
  • Joined

  • Last visited

  • Days Won

    5

MackeyK24 last won the day on April 26

MackeyK24 had the most liked content!

4 Followers

About MackeyK24

  • Rank
    Advanced Member
  1. Yo @hunts UPDATE: You DONT have to raycast You can if you CANT place your "WAYPOINT" or "TARGET" position "ON" or "REALLY" close to the navmesh mesh. You can use a function like the getNavigationPoint to BE EXACT and get the specific point on the navmesh relative to the agent position (that uses a the ray cast to get exact point directly UNDERNEATH the agent position). Works great if way points are ABOVE the mesh TOO far for the normal agent position to 'HIT' on. BUT IF YOU PUT LIKE A WAYPOINT game object at Y position 0 - 0.5 from the navmesh... that should hit too... i am using simple spheres as waypoints around the terrain and just making sure the position is "WITHIN" OR "TOUCHING" the navmesh... Working great and don't have to ray cast UNLESS i really need too
  2. Yo @hunts Found the issue... You need to give a target position 'ON' the navigation mesh... (basically it has to fall within the 'poly' checking of the findPath function)... This is how i addressed the issue. I added another 'navigation' function to my API: public getNavigationPoint(position:BABYLON.Vector3, length:number = Number.MAX_VALUE): BABYLON.Vector3 { if (this._navmesh == null || position == null) return null; var len = (length > 100) ? length : 100; var pos = new BABYLON.Vector3(position.x, (position.y + 1.0), position.z); var ray = new BABYLON.Ray(position, new BABYLON.Vector3(0.0, -1.0, 0.0), (len + 1.0)); var info = this._scene.pickWithRay(ray, (mesh) => { return (mesh === this._navmesh); }); return (info.hit && info.pickedPoint) ? info.pickedPoint : null; } and you can use like this: var navpoint = this.manager.getNavigationPoint(cube.position); if (navpoint) { var path = this.manager.getNavigationPath(minimoi, navpoint); if (path != null) { this.manager.setNavigationPath(minimoi, path, 4.0); } } Hope that helps you BTW... I am VERY curious in seeing what your AI code looks like... I wrote the system to be able to easily use the navigation system, but i have never seen what babylon js AI code like... Can you show me that... Please
  3. Thats probably because the picking info (and hitting close to the navmesh) is giving you a point on the navmesh... Meaning... It checks for vector.y in acceptable range and the point is within 'polygon vertices'... Look at this code from Navigation-Mesh: First the 'findPath' calls '_isVectorInPolygon' which in turn calls '_isPointInPoly' _isPointInPoly: function _isPointInPoly(poly, pt) { for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) { (poly[i].z <= pt.z && pt.z < poly[j].z || poly[j].z <= pt.z && pt.z < poly[i].z) && pt.x < (poly[j].x - poly[i].x) * (pt.z - poly[i].z) / (poly[j].z - poly[i].z) + poly[i].x && (c = !c); }return c; }, _isVectorInPolygon: function _isVectorInPolygon(vector, polygon, vertices) { // reference point will be the centroid of the polygon // We need to rotate the vector as well as all the points which the polygon uses var lowestPoint = 100000; var highestPoint = -100000; var polygonVertices = []; _.each(polygon.vertexIds, function (vId) { var point = this.getVectorFrom(vertices, vId); lowestPoint = Math.min(point.y, lowestPoint); highestPoint = Math.max(point.y, highestPoint); polygonVertices.push(point); }.bind(this)); if (vector.y < highestPoint + 0.5 && vector.y > lowestPoint - 0.5 && this._isPointInPoly(polygonVertices, vector)) { return true; } return false; }, So apparently , the target point 'needs' to be point on nav mesh... or real close to it. I am going try some different 'Ray' casting from the target agent position... ray case downward to 'predicate' navmesh to get picking info that way... See if that works
  4. DEAL... You work on that... Ill work on ONLY docs (will be for new version 1.1 beta... Not the current 1.0.1 proof of concept version). The newer one uses Babylon 3.0 and unity 5.6 (Big changes in Unity user interface for lighting, collision, materials, navigation etc...)
  5. Hey guys... I really need the community help on creating a class for babylon for skyboxes using a LDR (Tone mapped HDR) Cube Texture just as you would a HDRCubeTexture ... Except with ALREADY tone mapped RGB or RGBA pixels in the form of a png or jpeg. This will allow us to take HDR images from places like hdrlib.com and actually use them as a skybox. You can with a native HDR but it is a RESOURCE KILLER... you will NEVER get a good full resolution HDR skybox in your babylon game... the native HDR format works BEST in babylon when used real small like 256K and should be used for things like reflection and refraction textures... NOT the whole scene skybox because too much resources and takes for ever to generate ... Both at runtime and the pre-propocessor. But if we tone map that HDR to LDR WebGL can handle that pixel data just fine (plus the actual .png or .jpeg will be smaller 8-Bit per channel images). Here is an example HDR Tone Mapped Imaged i created with the BabylonJS Toolkit: http://mackey.cloud/files/bridge.png It is a very nice tone mapped version of an HDR file... Please download that file and take a look... I would like to use this file in place for a .hdr and use a new BABYLON.LDRCubeTexture class to display as skybox (Just like you would a regular HDRCubeTexture) I stated to "COPY" and cleanup HDRCubeTexture class as LDRCubeTexture... babylon.ldrCubeTexture.ts Basically i need SOMEONE to PLEASE modify the loadLDRTexture() function to use regular RGB pixels stored at 8-bits per channel (instead of 16-bit). I was able to figure out SOOOOO much on my own to create all the kool features i have in the new 1.1 toolkit... But i am LOST in that PIXEL code that is supposed to basically "split" cube faces pixel in an Array of Arrays... the result should be and array of pixels for each face...i THINK This is the very last piece i need to prepare the BabylonJS Toolkit Version 1.1 Beta for release... Any help would be freaking awesome Yo @Deltakosh I really need ya bro
  6. U3D - BabylonJS Toolkit using Babylon-Navigation-Mesh Extension Wanadev Lyon, France http://wanadev.fr/ Check out the current implication of navigation meshes and path finding: http://mackey.cloud/files/videos/u3dnavigation.mp4
  7. U3D - BabylonJS Toolkit using Babylon-Navigation-Mesh Extension Wanadev Lyon, France http://wanadev.fr/ Check out the current implementation of navigation meshes and path finding: http://mackey.cloud/files/videos/u3dnavigation.mp4
  8. It need to be a REALLY simplified mesh... with all your "WALKABLE" and "NON-WALKABLE" areas defined... So i just don't how you would do that during runtime with infinite terrain... BUT thats not to say you can't... I just don't know how... Also i think you can generate or make your nav mesh even in blender... I have seen a demo level.blend with a level mesh and a navmesh in the same blender file. Ill make a video showing my navigation mesh implementation
  9. Still working a few issues, like terrain texture atlas tiling... and PanoramaCubeTextures... And a final RE-WRITE of my documentation notes. But aside those three things... I am waiting for BabylonJS 3.0 (or whatever the next version will be called) to go stable... I can't use version 2.5 so i need a newer stable version to always be able to fallback on for the toolkit... Again i can't use 2.5 ... Its too old for the toolkit features... need a good 3.0 version to go stable.
  10. Yo @Codelain ... (Why doesn't show name for tagging... strange) I don't know about infinite terrain, but i use babylon-navigation-mesh as a part of the U3D - BabylonJS Toolkit. First... I generate navigation meshes from unity (using the Unity Navigation System) Second... When parsing the scene meshes, i look for navmesh and build zones: this._navmesh = this._scene.getMeshByName("sceneNavigationMesh"); if (this._navmesh != null) { var navigation: Navigation = this.getNavigationTool(); var zoneNodes: any = navigation.buildNodes(this._navmesh); if (zoneNodes != null) { navigation.setZoneData(this.getNavigationZone(), zoneNodes); } else { BABYLON.Tools.Warn("Failed to set scene navigation zone"); } } else { BABYLON.Tools.Warn("Failed to load scene navigation mesh(s)"); } I am working on a light-weight client side navigation api: // *********************************** // // * Scene Navigation Mesh Support * // // *********************************** // public hasNavigationMesh(): boolean { return (this._navmesh != null); } public setNavigationMesh(mesh: BABYLON.AbstractMesh): void { this._navmesh = mesh; } public getNavigationMesh(): BABYLON.AbstractMesh { return this._navmesh; } public getNavigationTool(): Navigation { // Babylon Navigation Mesh Tool // https://github.com/wanadev/babylon-navigation-mesh if (this._navigation == null) { this._navigation = new Navigation(); } return this._navigation; } public getNavigationZone(): string { return "scene"; } public getNavigationPath(agent: BABYLON.AbstractMesh, destination: BABYLON.Vector3): BABYLON.Vector3[] { if (this._navigation == null || this._navmesh == null) return null; var zone: string = this.getNavigationZone(); var group: number = this._navigation.getGroup(zone, agent.position); return this._navigation.findPath(agent.position, destination, zone, group); } public setNavigationPath(agent: BABYLON.AbstractMesh, path: BABYLON.Vector3[], speed?: number, loop?: boolean, callback?: () => void): void { if (path && path.length > 0) { var length = 0; var direction = [{ frame: 0, value: agent.position }]; for (var i = 0; i < path.length; i++) { length += BABYLON.Vector3.Distance(direction[i].value, path[i]); direction.push({ frame: length, value: path[i] }); } var move: BABYLON.Animation = new BABYLON.Animation("Move", "position", 3, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT); move.setKeys(direction); agent.animations.push(move); this._scene.beginAnimation(agent, 0, length, loop, speed, callback); } } public getNavigationAgent(agent: BABYLON.AbstractMesh): BABYLON.NavigationAgent { return new BABYLON.NavigationAgent(agent); } public getNavigationAgents(): BABYLON.Mesh[] { return this._scene.getMeshesByTags("[NAVAGENT]"); } public getNavigationAreaTable(): BABYLON.INavigationArea[] { return (this._navmesh.metadata != null && this._navmesh.metadata.properties != null && this._navmesh.metadata.properties.table != null) ? this._navmesh.metadata.properties.table : []; } public getNavigationAreaIndexes(): number[] { return (this._navmesh.metadata != null && this._navmesh.metadata.properties != null && this._navmesh.metadata.properties.areas != null) ? this._navmesh.metadata.properties.areas : []; } public getNavigationAreaName(index: number): string { var result: string = ""; if (this._navmesh.metadata != null && this._navmesh.metadata.properties != null && this._navmesh.metadata.properties.table != null) { var areaTable: BABYLON.INavigationArea[] = this._navmesh.metadata.properties.table; if (areaTable != null) { for (var ii: number = 0; ii < areaTable.length; ii++) { if (areaTable[ii].index === index) { result = areaTable[ii].area; break; } } } } return result; } public getNavigationAreaCost(index: number): number { var result: number = -1; if (this._navmesh.metadata != null && this._navmesh.metadata.properties != null) { var areaTable: INavigationArea[] = this._navmesh.metadata.properties.table; if (areaTable != null) { for (var ii: number = 0; ii < areaTable.length; ii++) { if (areaTable[ii].index === index) { result = areaTable[ii].cost; break; } } } } return result; } To use in a scene, example from nav mesh demo: // Create navigation box avatar var minimoi = BABYLON.Mesh.CreateBox("Me", 0.5, this.scene); minimoi.material = new BABYLON.StandardMaterial("navMaterial", this.scene); (<BABYLON.StandardMaterial>minimoi.material).diffuseColor = new BABYLON.Color3(1., 0., 0); minimoi.position = new BABYLON.Vector3( -3.7426157086231813, 0.32968033243017736, -5.410392414960055); // Setup point and click demo navigation var canvas = document.getElementById("cvs"); canvas.addEventListener('click', (evt)=> { var pickingInfo = this.scene.pick(this.scene.pointerX, this.scene.pointerY); if (pickingInfo.hit) { var path = this.manager.getNavigationPath(minimoi, pickingInfo.pickedPoint); if (path != null) { this.manager.setNavigationPath(minimoi, path, 2.0); } } }); The key .. super easy to use functions are ... manager.getNavigationPath(agent:Mesh, destination:Vector3): Vector3[] and manager.setNavigationPath(agent:Mesh, path:Vector3[], speed?:number = 1.0):void These wraps up a lot of functionality to basically get the path... Once you have paths you can alter/recalc new paths or whatever you want to make sure those are the paths, if any you want (might have some obstacle avoiding and path checking ... stuff like that). Then you call setNavigationPath to move the agent along a path (this is optional, you can move your agent however you want to follow your calculated paths) If you need more detail, i can make a small demo so you can see it action... Let me know
  11. FYI... Rotation is ok... have not tried scaling... but i imagine will be ok.... Take a look at this from another thread. The video show a non standard rig with its own animation and the mesh and bones have a 90 deg rotation on them... But after cleaning using my Maya Art Tools (but you can clean in whatever modeling software you like... Just keep in mind the points above when going through the Unity Pipeline) Hey @aWeirdo ... I made another one with sound... Animation is working knees look good and hands... Is Using NON-Standard or Legacy Unity 'Animation' component. Not the newer 'Animator' component which uses the built-in unity human ik control rigs (mechanim system) My clean up progress: http://mackey.cloud/files/videos/u3dcleaningi.mp4 Should work after a bit of 'U3D - BabylonJS: Game Ready Art Preparation' ... That is going to be my next video... I wanna show some of my new 'Babylon Game Art Tools' for both Maya (low-level art cleaning tools) and Unity (design time art optimization tools): Like : 1... Mesh Optimizer (combine and separate clean native geometry) 2... Extract (clean optimized native) meshes from complete unity scenes KEEPING the original object transform matrix. 3... Pre Bake Texture Atlas For Static Meshes (combined and separate meshes support) 4... Pre Bake Texture Atlas Skin For Skinned Meshes With Multiple Materials 5... Static Batching By Material At Runtime (actually Export time) 6... And my brand spanking new High Dynamic Range Tone Mapper... Tone map HDR cubemaps to 24-bit png or jpeg... (For use with my upcoming... Hopefully soon, but need help implementing RGBCubeTexture.ts that will be a RGB panorama skybox to use JUST like HDECubeTexture but with LDR RGB pixels instead... That way we can very kool looking skyboxes from HDRLIB without all the HEAVY HDR processing... The Magic Tone Mapper Will do that at design time and WebGL can load a much lighter web friendly version of a HDR skybox... Tone Mapped to 24-bit regular images) Stay Tuned
  12. @NasimiAsl here is a better atlas image to use: The url to atlas image: http://mackey.cloud/files/terrains_atlas.png and all textures in this atlas have been 9 copy and cropped and are png so keep BEST possible pixel precision.
  13. Send me that fbx model.... Ill run it thru with the scale on the model and put it thru the dance animations... I like to use the dance type animations for testing the bones and mesh deformation, because the dancing type things use WIDE range of motions... And when things ARE NOT QUITE rights... It shows in the dance. Anyways... send me model and ill take a look
  14. Hey @NasimiAsl Just so you know... there is still a bit of blur issue as well... Know you are working on the artifact issue but i just wanted you you to be aware of that incase you need to address while your in there: Here is original shot using 9 copy and crop in unity editor: And this on in babylon using the 5.0 edgeUvFactor... looks a little blurry compared to unity's render of the same 9 copy crop image:
  15. Will have a section dedicated to: 'Preparing Babylon Game Ready Art'