GithubHelp home page GithubHelp logo

uttejk / extrudemesh Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 505 KB

Extrude selected face in BabylonJS

Home Page: https://uttejk-extrudemesh.netlify.app/

HTML 2.56% JavaScript 86.36% CSS 11.08%
babylonjs reactcomponents reactjs

extrudemesh's Introduction

Extrude Mesh

This project aims to recreate the functionality of extruding a mesh, commonly found in digital content creation tools such as Blender, Maya, and Unreal Engine. The project provides a simple scene where you can interact with a cube at the center.

Demo

To try out the project, you have two options:

  1. Visit the following site: https://uttejk-extrudemesh.netlify.app/

  2. Clone the repository and run the following commands:

    • npm install
    • npm run dev

    After the installation is complete, open your browser and navigate to http://localhost:3000/ to load the site.

Instructions

  1. Extruding the Mesh

    • To perform an extrusion, click on one of the faces of the cube. This action will select the face for extrusion.
    • Once the face is selected, move your cursor. You will notice that the selected face moves in the direction of its normal vector.
    • To complete the extrusion, click again (release the click after the first click).

    Note: The extrusion functionality simulates a push-pull mechanism similar to SketchUp. It allows you to interactively modify the shape of the cube by extruding individual faces.

  2. Orbiting the Scene

    • Until the extrusion is confirmed or completed, you cannot orbit around the scene. This restriction ensures accurate interaction during the extrusion process.
  3. Resetting the Mesh

    • A reset button is located in the top-right corner of the scene. Clicking the reset button will revert the dimensions of the cube, undoing any changes made to it.
  4. Showing Mesh Edges

    • You have the option to show the edges of the mesh by uncommenting the relevant part of the code. Look for the comment indicating the section to uncomment.
    • By enabling the display of mesh edges, you can visualize the wireframe structure of the cube.
  5. Enabling Drag Behavior

    • To enable drag behavior for the mesh:
      • Uncomment the part in the code that says scene.onPointerUp() and the code within that function.
      • Remove the counter being set in the scene.onPointerDown() function.
  6. Changing the Mesh to anything else

    • You can choose any mesh and the extrusion function would still work, except, after the reset, it is going to reset to being a cube and there might be small bugs, that can be fixed in no time.

    Note: The drag behavior allows you to interactively drag the mesh instead of using the click-and-move method described earlier. Ensure the changes are made correctly for the drag behavior to work.

The Video Preview for the project is as follows:

ExtrudeMesh_UttejK.mp4

Feel free to explore the code and experiment with the mesh extrusion functionality in the Babylon.js scene!

For more details and to access the source code, visit the GitHub repository.

extrudemesh's People

Contributors

uttejk avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.