Kilombo

Members
  • Content Count

    145
  • Joined

  • Last visited

Everything posted by Kilombo

  1. Nice game, i don't remember, but it's fun to play
  2. There we go... small example in the playground, i'm surely doing something wrong. http://playground.babylonjs.com/#UFRH2#2 The intersection is always true. And thanks for the moveWithCollision example, it's helping me out.
  3. Thanks mate, I'll surely share it, that's the point But i do feel that's something missing, a callback or something. You see when we put the intersection method in the renderbeforerender, it seems to work it out, but we also have to put the movement in the renderbeforerender, and that is the question..... how do you call the moveWithCollision ? Because it doesn't seem to work, but maybe I'm wrong (again, lol). I wonder if someone already used this with moveWithCollision and with the importMesh at the same time.
  4. Yap, you are right mate, but... although the playground is a really great tool, when it comes to imported meshes and multiple files it becames impossible to show something, .... and no... unfortunately there's not so many topics and demos about it. Of course, my code is a crap, and since i'm in a short time... it's becomming to look "patched" and confuse (even for me), lol I already understood that I have to sort this one out on my one, it's a long shoot for someone to get my code. Any way,... Every help that appears is a good help and make me stay more near of my objective (like in the other topic, that stuff really helped me out, and i think i'm probably more near of the solution that i was before.
  5. Good afternoon everyone, I've beeing insisting in the past few days in this intersectMesh stuff. Nothing is working to me, so, I took one example from the tutorial, parcialy adapted it (badly by the way, eheheh) and there it goes. In my example, the color of the sphere indeed doesn't change, because there's no intersection, although... he goes in the if clause, i know that because the var called targetz had a value of zero, and only changes to 50 if there's a intersection..... but there's no intersection! So? Why does it enter in the if clause and actually do some stuff, and other don't. The ball should be red on there's one intersection, and yellow, if it doesn't. Maybe i'm doing something really wrong, really not sure. Please check my examples in the playgroung and check the console: http://www.babylonjs-playground.com/#KI6GH#1 I'm insisting on this, because i'm trying to implement one NPC (non player character) and the intersections are the key part for this. Thanks in advance.
  6. I will do better then that, you can log in in the web page and check it out for your self. the user and password for testing is xpto You have the mainengine.js, the patroller.js and the unit.js. mainengine - calls everything, and all the stuff. patroller - it's the class for the NPC's (the one that is not working), to put one working you just have to instantiate it like npc = new patroller(args); unit - exactly the same thing. Dont get scared with the portuguese comments on patroller, it has to be that way it's for a scholl project. but all the vars and the methods are pretty understanble. Thank you for your time RaanaW, you will probably save my grade Almost forgot, the website is, www.andromedaquest.com
  7. Here we go... You see, I can't work it out. If you check on the image, the first lines says "funciona" means it works..... but it shouldn't because has you can see on the other lines, that shouldn't be happening. In the next 3 lines, we have the destination cords (the cords of the ship that we can see in the image), next you have the originX of the mesh that should already have intersected the ship.... impossible, because on the last line there's the mesh patroller scale (200,200,200), now 200+2580 is 2780, no way it intersects something on 23000. the intersectMesh is set to True, because on false he doesn't detect anything.... I tried everything. If some one has any ideas, I'll be glad to hear them. I've got stuck......
  8. Thanks mate, it helped me. but.... When you have meshes imported from blender. I understand that we should parent a box or a sphere to it. And the problem looks to be in there, I'm probably doing i it wrong or checking the intersection in the wrong place. Because i wasn't beeing able to work it out, i tried with the OnIntersectionEnterTrigger, he was doing the same. Instead triggering when the collision occurs, he started imidiatly pursuing the other mesh (he should be patrolling, and if it finds, he pursues), so... I thought, wrong place, it's on the render loop, let me put it on the import mesh method, now he just patrolls, he doesn't pursue at all (he doesn't trigger the collision). Thanks anyway, and sorry for beeing a pain....
  9. Nope it's not possible because of the meshes. Although, I didn't find any example on intersections with moveWithCollisions. If you could tell me the basics, or where to find one example that would be very helpfull
  10. That's what I'm using (at least that was the example, that I saw to arrive at this state). Well.... problem is, I've got already collisions working. So I would have to change everything again to use it, and would loose the collisions. The point of this is to create one reactive agent, that pursuits players, attacks, etc, like one NPC. It's not generalized (since it doesn't have the Y axis), but it's a reusable class, so when i finish it i'll share it (if some one want's it, cause my programming is not that good, lol ). Thanks,
  11. It has I wasn't doing right, I already posted another question about this. I'm not beeing able to put the intersect working with moveWithCollisions, something is missing, i'm doing something wrong, i just can't figure it out yet. Thanks anyway Delta.
  12. Good afternoon, I'm trying to check intersection between 2 meshes. For that I created 2 bounding boxes. When the intersection happens, the NPC should pursuit the ship. Although, it's not working, for some reason, the NPC is behaving like it had intersedted all of the meshes in the screen at the same time (like if the bounding box had infinite size. there's part of the code. activate is called on the main scope, The example his checking the intersection between the this.boundingbox and the playermesh, but i already tried with the boundingboxship (of the player), and tried with "false" also, it doesn't work, with false doesn't detect anything at all. I also commented out all the collision stuff, including the ellipsoids, still nothing. Thanks for the help in advance. patroller.prototype.activate = function(){ var a = this.units.length - 1; console.log(this.arrived); if (this.arrived === true){ var tempx = Math.floor(Math.random()*(this.mapSize-1+1)+1); var tempz = Math.floor(Math.random()*(this.mapSize-1+1)+1); this.targetX = tempx; this.targetZ = tempz; this.arrived = false; } //estado patrol if ((this.arrived === false) && (typeof(units[a].getMesh())!=="undefined")&&(typeof(this.mesh)!=="undefined")){ //this.npcPosX = temp.getPositionX(); //this.npcPosZ = temp.getPositionZ(); this.move(this.targetX,this.targetZ); //var meshtemp = units[0]; //console.log(units[0].getMesh()); //console.log(meshtemp.mesh); for (var i=0; i<this.units.length; i++){ if (typeof(this.units[i].getMesh())!=="undefined" ){ //console.log(units[i].getMesh()); //console.log(this.mesh); //console.log(meshtemp); //console.log(this.boundingBox); //console.log(units[i].boundingBoxShip); if (this.boundingBox.intersectsMesh(this.units[i].getMesh()),true){ console.log("funciona"); this.attackedUnit = this.units[i]; //estado de perseguição this.move(this.units[i].getShipPosx(),this.units[i].getShipPosz()); var targetx = units[i].getShipPosx(); var targetz = units[i].getShipPosz(); var posix = this.getPositionX(); var posiz = this.getPositionZ(); var dx = targetx - posix; var dz = targetz - posiz; var vector = Math.sqrt(dx * dx + dz * dz); if (vector<=25){ //estado de ataque //attack (); } } if (this.armor<5){ //estado de fuga this.move(Math.floor(Math.random()*(this.mapSize-1+1)+1),Math.floor(Math.random()*(this.mapSize-1+1)+1)); } } }
  13. Forget it.. it's solved, it was something related to how javascript works. Javascript was actually trying to do getMesh() before the mesh was loaded, solved with a if (typeof !== undefined). But I still have a problem. The Blender imported meshes don't seem to have _boundinginfo. So i'm not beeing able to test the intersection. Is this a bug, or I really have to parent a new bounding box to the mesh?
  14. Good morning everyone, I'm trying to return a mesh from one object to the main scope, something like. unit.prototype.getMesh = function(){ return this.mesh;}.....main scope:unit1 = new unit();..all the operations with the unit (load mesh, etc...)..console.log (unit1.getMesh());Problem is.... this doesn't work, returns undefined, but... if I put a console.log(this.mesh) on the getMesh method, I do get the mesh on the console. Strange..... The problem is.. I do need to return the mesh, because I need to test the intersection between that mesh and another one. Ideas anyone? Thanks in advance.
  15. eheheheh, i tested it on my laptop... Anyway, it's a hell of a good work there. I'm going to try and implement it in my game to do something near a GUI, justo to choose locations, fleets, etc.. So the frame rate is not really important, but the response time is one issue. But i'll try to do a draft implementation to see how it works out and I let you know. Thanks for the good hard work.
  16. Hey mate, you where right, my mobile chrome just updated and cleared my definitions. But I'm posting for diferent reasons. Do you think it's possible to make it work a bit more faster ? It's still a bit slow, when you press a button it takes a while to answer to the "click". Thanks in advance.
  17. I actually feel that davrous and delta tutorial videos are quite good. they gave you some good knowledge of how 3d works. but if you look for opengl tutorials, you will find stuff related to matrices transformations, and the really basic transformations you need to do in order to translate or rotate a mesh. if you actually learn those theoretical stuff, you will have no problems to get in to bjs, or in some other engines/api's.
  18. can't see it chrome in my android smartphone. is it normal? I usually see most of the things with it. it says that browser doesn't support webgl..
  19. Great stuff mate, I'll try it and give feedback. I really need such a handy tool for my game.
  20. movewithCollision method adds a vector3 to the existing vector3 position of the mesh and to the mesh ellipsoid. So if he wants to scale instead of translate it will be hard to use movewithCollision (i think), since there's not actual movement. I have to agree with Wingy on this scalewithCollision would be cool stuff I played a bit with his playground demo, and i don't see a way to do it with movewithCollision (but i'm a newbie), although... there's some peeps that may code a good "work around". Not me for sure, I'm still struggling with collisions also
  21. Good morning, Try this post http://www.html5gamedevs.com/topic/12990-how-to-collision-2-object/?hl=movewithcollisions#entry74655 This exact example is quite good http://playground.babylonjs.com/#1NQTNE#11 it uses scene.pick.
  22. Ok... I got it (finnaly), there where 3 mistakes that i was making: First i was updating the mesh twice, that was messing everyting up, and was the major problem. The second problem was the mesh's sizes and proportions vs the world and the ellipsoid. The third was that cords need to be floats, but in database they where int's, and that was also messing up. I still have 2 issues: - player mesh is always resetting to (0,0,0), and then starts moving to the is original cord (the one that gets from the database). - i just finded that all mesh's appear in a really small size in (0,0,0), how can i make this dissapear? Thanks guys.
  23. Good morning Dad72, The example you are giving me is the one that i first started looking, but where do you put the destination mouseX and mouseY (from the scene.pick) in there? I'm using this example http://playground.babylonjs.com/#1NQTNE#11 this one is similar to what i want to get. Thanks in advance.