Giter Site home page Giter Site logo

Comments (8)

DavidArayan avatar DavidArayan commented on July 23, 2024

Hello @xCured2,

The Example Scenes are just that, example code to show you how the slicer works. They are not part of the core framework.

When you import the Slicer framework, there are various extension methods which you need to use to cut objects. The one most suitable for you is the gameObject.Slice(worldPosition, worldDirection). So you will need to do the following.

  1. Detect a Collision between the tree and the sword
  2. Grab the tree GameObject, ensuring it has the MeshFilter with a mesh in it (describing the tree)
  3. Grab the position and orientation of your sword and call tree.Slice(swordWorldPosition, swordWorldDirection).
  4. Grab the sliced GameObject (if any) and do whatever you'd like to do. You may need to manually destroy your tree and re-instantiate the returned GameObject's.

All things given, the slice should be a single line of code.

Keep in mind that the Slice returns new objects which you will need to re-attach any scripts into (if you had any on the tree).

Hope that helps!

from ezy-slice.

 avatar commented on July 23, 2024

That indeed helped a lot! I was just unsure on how to exactly use this but that comment has it all figured out for me!

Thank you!

from ezy-slice.

superbuck avatar superbuck commented on July 23, 2024

Hi,

I've got a similar question:
I want to slice an object in either the x axis or the y axis. (Worlddirection)
For the Worldpoint I define a point on the object (chosen with a airtab on the object)
If I do so, the object is always sliced with the same plane for different points on the object.
What am I doing wrong?

from ezy-slice.

DavidArayan avatar DavidArayan commented on July 23, 2024

@superbuck The Plane you use to slice also has a rotation defined, the point only defines the position, you also need to define the rotation. Rotation is arbitrary and will change the axis that the slice occurs, check some of the samples on how it's done, cheers!

from ezy-slice.

superbuck avatar superbuck commented on July 23, 2024

Why do I ned to define the rotation?
Just that I get it right: with the Position one defines the a point on the cutting plane and with the Direction one defines the normal to the plane. With this a cutting plane should be created at the defined Position with alignment to the normal, is this right?

from ezy-slice.

DavidArayan avatar DavidArayan commented on July 23, 2024

Correct, The normal defines the facing direction of the plane, essentially it's rotation in 3D space. So just make sure the normal that you provide is actually a normalized vector.

from ezy-slice.

superbuck avatar superbuck commented on July 23, 2024

Thank you, that helped with that problem.
Another issue witht the Ezyslice Toolbox:
When I cut my object, then at some places there are "holes", so no mesh is generated, where before was an mesh. Do you have any suggestion to solve this problem?

from ezy-slice.

DavidArayan avatar DavidArayan commented on July 23, 2024

Hello,

That sounds like a bug, if you could open a new bug report issue and post a screenshot of the problem occurring that would be fantastic! thank you.

from ezy-slice.

Related Issues (20)

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.