Jump to content

wire objects and animations


juanmajr93
 Share

Recommended Posts

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

tuberias.PNG

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

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...