Search the Community
Showing results for tags '2.6'.
Hi all, Update - 17 / 02 mesh.collisionGroup = maskNumber; have been added to AbstractMesh. Two new properties, collisionGroup and collisionMask, have been added to AbstractMesh, collisionMask have been added to FreeCamera, and is coming with 2.6. Why? What do they do? The collisionGroup & collisionMask checks whether a camera Vs mesh or mesh Vs mesh collision should happen. Thus, it allows us to customize collisions, enabling us to decide what meshes should collide with each other and which meshes should collide with the camera An example could be to have collisions between the camera and a box aswell as the camera and a sphere, but no collision between the sphere and the box all at the same time. Once it's live, it will work like this; var group1 = 1; // x to the power of 2, starting from 1. var group2 = 2; // 1*2 = 2 var group3 = 4; // 2*2 = 4 var group4 = 8; // 4*2 = 8, and so on. // This mesh is part of the group1 collisionGroup, camera's and other (moving) meshes with group1 in their collisionMask will collide with this mesh. mesh.collisionGroup = group1; // While moving, this mesh will collide with other meshes which has either group1 or group2 as their collisionGroup mesh.collisionMask = group1 + group2; // While moving, the camera will collide with meshes which has either group1 or group2 as their collisionGroup camera.collisionMask = group1 | group2; // doing group1 | group2 has the same effect as, but is less dynamic than, group1 + group2 You can also do; camera.collisionMask = group1; // Set mask to collide with group1. camera.collisionMask += group2; // Set mask to also collide with group2. camera.collisionMask -= group1; // Remove group1 from mask so we only collide with group2. // Take careful note before using this method, to avoid issues, you must first override the default mask (-1) by doing cameraOrMesh.collisionMask = your_group_x_variable; It is currently not available for webworkers. Backwards compatibility, If this isn't something that interests you, you're all good, nothing has changed. Masks Masks are numbers to the power of 2, starting from 1. Special masks -1 ; Always collides. 0 ; Never collides, overrides mask -1. // not recommended to use on camera with standard gravity applied. Standard masks , x to the power of 2; 1 | 1*2 = 2 | 2*2 = 4 | 4*2 = 8 | 8*2 = 16 | etc. 1 2 4 8 16 Etc PG Example; The camera collides with the ground & box, but not with the sphere and the sphere and box doesn't collide with each other either. http://www.babylonjs-playground.com/#20PQBI#43 Cheers. If you have any questions, ideas or thoughts, please do continue the discussion below.
Made a small demo on how to use the Webcam in 2.6. https://www.babylonjs-playground.com/#EETLE#0 More info about Video here: http://doc.babylonjs.com/tutorials/advanced_texturing. From what I gather you don't need to use a shadermaterial if you just want to display the webcam stream. However applying it to a shadermaterial allows for custom pixelshaders on the stream. [EDIT] Had some time so I made a sample using standard material for the video. https://www.babylonjs-playground.com/#LIVJ8#0 In this one I needed to set the emissiveColor because the scene has no lights. Also use of the webcam requires a HTTPS connection (in Chrome) which might require use of a local webserver if anyone is developing at home.