juanmajr93 Posted January 10, 2017 Share Posted January 10, 2017 Hi all, I am designing the subsoil of terrain in my scene. This subsoil is formed by tubes which represents water 's canal or electric 's net. Well, to allow the view under terrain I have to show it as a wire object. My first question is: how can I show only the ground object as wire mode? I have made this but changing to this mode the visualization of all elements of scene... The second question is relative to animations. Inside the tubes I would like to add animation of water to get a better level of realism. Firstly, I can give some transparency to material of tubes and after i should add this animation. Do you know how can I add this animation inside of tube? In thefollow image you can see my scene to understand me better: Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 10, 2017 Share Posted January 10, 2017 Hello to turn on wireframe, you just need to set mesh.material.wireframe = true For your animation you could think of a smaller tube with a texture on it and you can animate texture.uOffset to simulate the movement Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 10, 2017 Author Share Posted January 10, 2017 Hi again, good idea!! There would be a movement of texture to simulate the animation of water. However, I have never used the param uOffset to simulate this. Could you show me some examples of this? Always, thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 11, 2017 Share Posted January 11, 2017 Something like that:http://www.babylonjs-playground.com/#10KKS5#1 Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 11, 2017 Author Share Posted January 11, 2017 @Deltakosh It is done and the result is amazing! I share with you my proyect:http://217.217.131.1:8081/subsuelo/ Another question as you can check is relative to strange hiding of boxes. They are drawn using SPS and when you are moving around scene they disappear and I dont know the reason... satguru 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 12, 2017 Share Posted January 12, 2017 ping @jerome for sps Quote Link to comment Share on other sites More sharing options...
jerome Posted January 12, 2017 Share Posted January 12, 2017 very beautifl scene. I didn't get what disapear in your scene, but maybe is it related to the SPS visibility : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 12, 2017 Author Share Posted January 12, 2017 Perfect! @jerome I used this function: SPS.isAlwaysVisible = true; and I solved my problem GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 13, 2017 Author Share Posted January 13, 2017 Hi @jerome If you saw my project that I posted here, you can see I use SPS to draw boxes and tubes. Well, now I have to interact with them so I have added the follow code: var makeOverOut = function (mesh) { mesh.actionManager.registerAction(new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOutTrigger, mesh.material, "emissiveColor", mesh.material.emissiveColor)); mesh.actionManager.registerAction(new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOverTrigger, mesh.material, "emissiveColor", BABYLON.Color3.White())); mesh.actionManager.registerAction(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.OnPointerOutTrigger, mesh, "scaling", new BABYLON.Vector3(1, 1, 1), 150)); mesh.actionManager.registerAction(new BABYLON.InterpolateValueAction(BABYLON.ActionManager.OnPointerOverTrigger, mesh, "scaling", new BABYLON.Vector3(1.1, 1.1, 1.1), 150)); } I call this function after sps is created.... redTuberias = sps.buildMesh(); redTuberias.material = matTuberia; sps.setParticles(); redTuberias.actionManager = new BABYLON.ActionManager(scene); makeOverOut(redTuberias); However, I dont get any response when my cursor is over tubes 's net... What could be the cause? Thanks! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 13, 2017 Share Posted January 13, 2017 you might set your sps.mesh as pickable or the whole sps : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles in this case, don't forget either to refresh the visible size at least once, either to enable the bbox computation in order to set the right visibility (pickability) : http://doc.babylonjs.com/overviews/Solid_Particle_System#sps-visibility Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 18, 2017 Author Share Posted January 18, 2017 Hi @jerome I have working about SPS and I have the next question: 1.- How can I pick a particle of SPS which are under ground? A this moment I cant pick them and I cant rotate the camera when I clic over ground... The code that I am using is the follow: scene.onPointerDown = function(evt, pickResult) { var faceId = pickResult.faceId; var idx = spsTuberias.pickedParticles[faceId].idx; var p = spsTuberias.particles[idx]; p.color.r = 1; p.color.b = 0; p.color.g = 0; spsTuberias.setParticles(); }; 2.- I need to do the same but when cursor is over tube. I use the follow code however, all SPS mesh is selected and I need to do this for each particle. var makeOverOut = function (mesh) { mesh.actionManager.registerAction(new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOutTrigger, mesh.material, "emissiveColor", mesh.material.emissiveColor)); mesh.actionManager.registerAction(new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOverTrigger, mesh.material, "emissiveColor", BABYLON.Color3.White())); } redTuberias.actionManager = new BABYLON.ActionManager(scene); makeOverOut(redTuberias); You can check here: http://217.217.131.1:8081/subsuelo/ Thanks! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 18, 2017 Share Posted January 18, 2017 Could you reproduce it in a PG please ?, I can't download your scene ... have you checked this : http://doc.babylonjs.com/overviews/Solid_Particle_System#pickable-particles isPickable: true Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 18, 2017 Author Share Posted January 18, 2017 @jerome yes my SPS isPickable howeber it is under the ground and when I use the method before and it seems that SPS dosnt receive the pickDown event. Try again to this link http://217.217.131.1:8081/subsuelo/ , now is lighter Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 18, 2017 Share Posted January 18, 2017 set ground.isPickable = false ? *shrug* Ground is intercepting picks? Maybe. Quote Link to comment Share on other sites More sharing options...
jerome Posted January 18, 2017 Share Posted January 18, 2017 I agree with @Wingnut Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 18, 2017 Author Share Posted January 18, 2017 YES!! it was that. However I want when I clic outside of tubes, they must recover the material that had before. I dont know the event of unselected this tube... Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 18, 2017 Author Share Posted January 18, 2017 @jerome @Wingnut Moreover, I need to add overMouse action. I have done it to mesh's box however, I don't know how can I do using SPS. I have read the manual of SPS an there isnt any method related. Quote Link to comment Share on other sites More sharing options...
jerome Posted January 19, 2017 Share Posted January 19, 2017 http://www.babylonjs-playground.com/#2FPT1A#68 just search in the forum : Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 19, 2017 Author Share Posted January 19, 2017 Thanks @jerome because of your fast answers. This was that I need it! However with particle of sps I can only change color and I want change material of it. To show the overMouse action I would like to create an halo arround the piece changing emissiveColor property. Do you know how can I do it? Another question is the follow: Are there any control's variable of particle to diferenciate between over or clic? Now I am using "p.picked" only... You can look the progress of application in the same link Thanks! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 19, 2017 Share Posted January 19, 2017 There is tool to control the way a particle is picked... actually, the particle pickability is just the SPS mesh pickability. So p.picked is the right way to go, like for any other meshes. the SPS is only a mesh, so it's given only one material at once. But you can play the particle uvs property to set what part of the texture image you want to apply to each particle. Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 19, 2017 Author Share Posted January 19, 2017 Okey @jerome and if you change color of a particle and later you want to reset this value. What is the value by default that had this material of SPS? I think that are1,1,1 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 19, 2017 Share Posted January 19, 2017 Please read carefully all the SPS documentation (I spent so much time to write this) : http://doc.babylonjs.com/overviews/Solid_Particle_System#colors-and-uvs Particle colors are vertex color, they can mix with texture/material colors. Quote Link to comment Share on other sites More sharing options...
juanmajr93 Posted January 19, 2017 Author Share Posted January 19, 2017 yes I have made it! Thanks @jerome Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.