Sign in to follow this  
Followers 0
juanmajr93

wire objects and animations

23 posts in this topic

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

Share this post


Link to post
Share on other sites

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 

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

set ground.isPickable = false   ?  *shrug*  Ground is intercepting picks?  Maybe.  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.