Search the Community
Showing results for tags 'subtract'.
-
Hi, I saw the code presented in the link https://playground.babylonjs.com/#1NQTNE#11 and played many times. I felt "moveWithCollisions" is full of magic . it seems that with the help of "movewithCollisions" the mesh can smartly move and move little by little and finally manage to find its path to reach its destination. I checked the code but was not able to figure out how to use it exactly, there is few comment or remarks to tell what's the purpose of some important lines . so I listed these important lines that I didn't understand as below. can anyone please help to explain what's the purpose of these critical lines? (please notice that I use "//" to bring up what my question is ) // move to clicked coordinates ............ if(meshPlayer.destination) { var moveVector = meshPlayer.destination.subtract(meshPlayer.position); if (moveVector.length() > 1.1) { //1.why use 1.1 ,other than 2.2 or 0.8 or any length else? is it related to the player size 1 while downcasting a ray ? moveVector.y = GRAVITY; //2.GRAVITY is -0.5 as defined earlier, but why moveVector.y must be -0.5? what's the purpose to assign moveVector.y ? moveVector = moveVector.normalize();//3.what's the purpose of "normalize"?what's the benefit of doing this? is this line mandatory? moveVector = moveVector.scale(0.2); //4.why to shrink the moveVector to 1/5 of its original size? why not 0.1 or 2 or some number else? if(meshFound.distance > 1.1){moveVector.y = GRAVITY;} //5.why 1.1 again? meshPlayer.moveWithCollisions(moveVector); } else { meshPlayer.destination = null; } } .......... It's really appreciated for your time. Edit Your content will need to be approved by a moderator
-
- avoid obstables
- subtract
- (and 5 more)
-
I am trying to perform a Boolean subtraction operation on an imported Mesh (skull.babylon). I have downloaded the demo from Babylon CSG. Demo: http://www.babylonjs-playground.com/#NZPX4 The operation seems to work on native meshes, but not on imported meshes. Has anyone tried this before? I used the loader to bring in the mesh, and then tried to reference it in the subtraction operation. So far, no luck Thanks indexCSG.html
-
Does anybody know how to subtract the alpha values from a shape? After hours of research, my best bet is to utilize an alpha filter (link) The current Shape.mask value does not seem to have an easy way to invert masks (link) Example of what I want to achieve:
-
Does anybody know how to subtract the alpha values from a shape? After hours of research, my best bet is to utilize an alpha filter (link) The current Shape.mask value does not seem to have an easy way to invert masks (link) Example of what I want to achieve:
-
Hi! I am new here and to pixi.js and game development in general and I wanted to know if it is it possible to subtract a graphics shape from another shape using pixi.js? I know it is possible using canvas' "globalCompositeOperation" with "destination-out" or "source-out" like is demonstrated here: https://developer.mozilla.org/samples/canvas-tutorial/6_1_canvas_composite.html but I wanted to know if it is supported by webgl as well and if there's an already built method in pixi.js for it. if such a method does not exist yet, what would be the best way to implement it? thank you for your time.