• Content Count

  • Joined

  • Last visited

About Kilombo

  • Rank
    Advanced Member
  • Birthday 11/07/1978

Profile Information

  • Gender
  • Location

Recent Profile Visitors

1620 profile views
  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. 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: 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,
  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.