Search the Community
Showing results for tags 'face'.
Found 9 results
solved Set texture per face of loaded mesh
yLacaute posted a topic in Questions & AnswersHi ! I am trying to set 2 different textures _by code_ on a loaded mesh exported of Blender. There is no problem on "creating" a mesh from MeshBuilder and set it faceUV with options, but from a "loaded" mesh (created from blender, without any texture) I don't manage to do it. I give this playground for a start (my code is too complicated to put it in a playground) : https://www.babylonjs-playground.com/index.html#YYQ1LC#39 The goal : set any texture (from internet) to the loaded mesh to any face of the Dude.babylon. I tried few things like VertexBuffer.UVKind but... it should not be the way to go More details : My Blender object is a single plane : 6 vertices, 2 faces. My goal is to dynamically set different texture on each face . The wireframe show me the 2 faces but I have no idea how to set them the texture. Thanks for any help
jerome posted a topic in AnnouncementsHi Folks, I'm proud to introduce a brand new feature already integrated in the BJS core : FacetData This feature provides some methods to access and to play with mesh facets. Facets are the elementary triangles drawn by WebGL. We call them "facets" here in order to be not confused with the term "faces" : a box has 6 squared planar faces but each face is drawn with 2 facets (triangles). In bulk, you've got : mesh.updateFacetData(); // enables the feature or recompute things mesh.disableFacetData(); // disables it mesh.isFacetDataEnabled; // boolean, as it says ... mesh.facetNb; // number of facets mesh.getFacetPosition(i); // gives the world position of the i-th facet mesh.getFacetNormal(i); // gives the world normal values of the i-th facet mesh.getClosestFacetAtCoordinates(x,y,z); // gives the index of the closest facet to (x,y,z) in the world // etc ... and plenty of other fun tools to play with ! Please have a read at the doc (it should be in the section "Advanced Tutorials" of the doc site as soon as Monday the 23rd of January... if @RaananW accepts my bribes) and at the provided PG examples. For those who cares, all the facet indexes here are the same than the ones used by the object PickingInfo or the pickable SPS, called there faceId. So you can easily mix all these different features. Example : to get the normal of the facet from a picked point on a mesh. Have fun
Find all facets (vertex) in surface
Luca posted a topic in Questions & AnswersFrist- Hi evryone, i'm newbie on Babylon Js. Second - i'm lookin for similar args , with no goal. - - sorry if alredy exist one Problem I'm looking for method to select all surface facets (basically I select the entire surface) My idea is: R1: "Facets with two vertices equal are contiguous" ( evaluate a set of coordinates) R2: "Valuate the same oriented 'Normal' facets " Evaluate true of R1 && R2, made well done job? Thanks 4 help
2D Sprite Animation on a Box's face
royibernthal posted a topic in Questions & AnswersI'm trying to have 1 face of a box display a 2D animation. The idea would be the same as having it display a texture like in the link below, only an animation instead. https://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors How should I go about achieving it?
Set box's face texture to custom image
royibernthal posted a topic in Questions & AnswersHi, I'm new here, my name is Royi. I'm loading a custom image (.png) using AssetManager, on complete I'm rendering a scene with a box. I want one face of the box to display the custom image I loaded. I experimented with Sprite but it seems to be completely restricted to 2D (by definition I guess), I was hoping for a thin 2D sprite I could rotate around the z axis as well. Is there some option to set the texture of a polygon's face to an image? Otherwise, how do I achieve it?
Methods of character creation
eljuko posted a topic in Questions & AnswersHey, I must apologize for asking so much or in such large scale. but there's some stuff that wont just "click". I do not ask u to tell me precisely how to do but more like how its done in theory. I'll try to categorize the subjects with numbers or something to make the questions more easy to answer. 1. first things first. I'v read something that i cant use "actions" from blender. how i should make the skeletal animations then? in one big animation that contains all the animations for Walking, running and idle ect. and somehow using the frames of specific range in babylon.js? 2. Then how about the gearing and character customization? I know that i could place the sword for example by appending it to bone or something, but how about clothing and character hair; do i create the clothes as objects in blender and then display the wanted item or change texture? 3. does anyone know a good page to read about these? =) - Thanks, eljuko
Data storage for mesh faces
UP_AND_ATOM posted a topic in Questions & AnswersI've got a fairly good understanding of how meshes keep track of their vertices, but how do they store data associated with faces? I've been searching through the documentation and digging into the mesh object locally, but I'm not understanding this yet. Are faces stored in a separate array, or is there an array that stores edge connections between vertices? How are faces stored and rendered? I've been able to extract screen coordinates for each vertex of a moving mesh, but I'm hoping to understand how that is turned into triangles during rendering. Thanks!
Calculating horizontal distance with arcade tilemaps
nomolosvulgaris posted a topic in Phaser 2I want to calculate a distance between object of the platformer and a place it can possibly achieve without moving up or down (face the obstacle or fall down), just left or right. So I use test bodies called this.shadowSide (to watch wall facing) and this.shadowDown (to watch falling). Prefer to call them "shadow bodies". I use this.game.physics.arcade.overlap to determine if the shadow body overlaps the floor. I move shadow bodies (left or right, depending of the direction I need), check overlaps and either continue searching or return a distance. It works well for sprite floors. The trouble is that this.game.physics.arcade.overlap doesn't seem to work with tilemaps. So I am looking for a way to indicate body vs. tilemap overlap. Or to calculate the distance in another way. Did anyone do that? The method with this.game.physics.arcade.overlap used with tilemap (left) and sprite floor (right): http://codepen.io/anon/pen/dPxbJw?editors=001 (use left and right cursor arrows to move bumpers and watch the distance change)The issue with body vs tilemap overlap: http://codepen.io/anon/pen/pvXGWR?editors=001 (I don't know whether or not it is an actual error)
Enable only one or two faces of a polygon bodyHello there I have a simple question: Is it possible to enable only one or two faces of a polygon body ? Furthermore, would it make me gain performances ? Is it worth it ? Thank you Edit: In fact I'm talking about the physic properties (will it collides or not), maybe it wasn't clear in my post.