Forum

User posts Spartan117
05 October 2017 02:16
Hi, I'm having a really annoying error due to the recent blend4web update. The problem occours when we have a particle system where particles are rendered using a node material containing an input node of type "Value". The error tells as follow: B4W ERROR: Shader compilation/linking error: particle_system.glslv, particle_system.glslf, materials: "ParticleMaterial". It's important to notice that this error came out with the latest blend4web releases since in the version 17.2.1 (which I was using before the update) all were ok. Due to this error I'm not able to animate the "Value" node of the node material of my particles, which is really annoying to me cause I use such a technique in most of my blend4web projects. I'm attaching a simple demo scene where you can easily see the problem by fast previewing the scene.
09 August 2017 22:31
Ok thank you all I'll try with some programming
08 August 2017 12:15
Hi I'm trying to make an effect for a b4w project I'm currently working on, this effect I think should be achievable by using an object as a 3d alpha mask for another object so that this object will be visible only when it is overlying the mask object in camera view. To better figure it out let's imagine we have an opaque sphere (our mask) inside an alpha textured cube, and we want to make visible only the points of the cube that overlap the sphere in camera view. I'm attaching an image that shows such a context, on the left there are the mask and the object we want to mask, on the right the result I want to achieve.

I'm attaching also the .blend containing the demo scene I used to render the attached image. That said, is there a way to achieve it in blend4web? I'v tried to use node materials as well as different transparency combinations without success so far
12 June 2017 20:36
all right and thanks a lot for the support
12 June 2017 18:18
Finally! dont know .. maybe my english is worse than I thought however I tried a lot before posting my problem here, including the m_physics.apply_torque(inParams[0], 0, 0, 0); which doesnt work because it resets only the currently active angular forces (torques) applied to the object by using the same function. The only working solution I found is, as you guessed, to create a new instance of the object every time we throw, it works but is a bad workaround I think, cause we waste time creating an identical new object (in case of complex meshes we could have a little fps drop every time we do it) while we already have one, that's the reason why I wrote in the forum, cause I wonder if there is a nice solution to this problem, like a way to tell the physics engine to reset all the forces and velocities it retains on the ball
12 June 2017 12:19
I saw your video and the ball behaves very reliably as you said, and with the blocks you added it really looks like angry birds ;)
As for the angular velocity.. dont know if you noticed but the rotation of the ball when you throw is the same as it was before the reset, in fact if you always reset the ball before it touches anything (as I did in my video) then the ball will never rotate on itself, give it a try and let me know if I'm right
12 June 2017 01:43
Thanks so much for your support and thanks for appreciating the project, it took me around 15 minutes to be made. I took the node out of the loop as you suggested but unfortunately the problem still remains. However what do you tell me about the angular velocity? as you guessed the m_physics.apply_velocity(inParams[0],0,20,0) applies only a linear velocity to the ball local Y, in other words the ball should not rotate on itself at all after throwing, whereas it does (except the first throw however) .. do you have the same issue or it is only me?
11 June 2017 16:53
Since the ball once thrown is controlled by physics it goes downward like the projectile motion, but that's not the point however, the actual problem is as I mentioned in the previous post that the ball after the first throw is behaving glitchy, you can crearly see when I throw the ball that it goes for a couple of frames to the position where it was before the reset and then goes back suddenly to the cannon and continue the normal projectile motion, that is weird, in addition the ball has an angular velocity when I throw it, that is weird again since in the code I'm applying only a velocity toward the local Y axis
11 June 2017 13:19
Thanks for helping, my application is something like pokemon go, so I have to throw a ball over and over and after each throw I need to reset the ball to the initial position to throw again. However my problem is pheraps not so understandable so I'm uploading a simple demo scene, with the .blend and the javascript file and also a very short .flv video demonstrating the problem. You can see that the ball is kinda glitchy after the first throw, it saves the angular velocity it had before the reset and also glitches for a couple of frames to the position where it was before the reset. I hope you can really help me out solve this issue
11 June 2017 09:03
Here is the code:

if(throwButtonPressed) {
m_physics.enable_simulation(ball);
m_physics.apply_velocity_world(ball,0,20,10); }

if(resetButtonPressed) {
m_physics.disable_simulation(ball);
m_transform.set_rotation_v(ball,m_quat.create());
m_transform.set_translation_v(ball,startPosition); }

the point is: when I enable the simulation after disabling it the ball still save the linear and angular velocity it had before disabling the simulation whereas I would like the ball to be "physically clean" when I throw it again