Advertisement

I need help in the creation of "tree felling"

Started by January 07, 2018 01:32 PM
7 comments, last by Nierkool 6 years, 8 months ago

I make a one game, and i want to do a sistem of tree feling, like in Lumber Tycon 2.But i do not know how do this.

If anyone has any ideas how to do this, please write!

Start by breaking down the "system" in smaller pieces, then tackle each piece separately. (ie Divide and Conquer holds very much in computer programming).

 

For tree felling, start with having a tree, and displaying it. If "displaying it" is too complicated for you, study how to display 3D objects first (ie again apply Divide and Conquer).

With a displayed tree, add making a cut at some point in the tree, and splitting a tree in 2.

Then add physics so the tree (or parts of it) fall down as you'd expect.

 

Advertisement

Thanks, but i want the tree to split up where the character beats,that is, the vertices of the cut appear where the character beats.(Look at Lumber Tycon 2 in Roblox) 

1 hour ago, Nierkool said:

Thanks, but i want the tree to split up where the character beats,that is, the vertices of the cut appear where the character beats.(Look at Lumber Tycon 2 in Roblox) 

Re-read @Alberth post. What have you achieved so far? Can you display a tree? 

There's no point in people going into a detailed discussion of how to break up a tree if they don't know your starting point.

if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight
10 hours ago, Nierkool said:

Thanks, but i want the tree to split up where the character beats,that is, the vertices of the cut appear where the character beats.(Look at Lumber Tycon 2 in Roblox)

Then you also saw the little crosshair that points to that position.

 

Staring at the total picture and then expecting you will find a solution is not going to work, it's just too big to comprehend. The only working tactic I found so far is what I said, decompose into smaller sub-problems until they seem solvable, then solve each sub-problem.

Edit: Thus if my second step is not solvable for you, decompose it further.

Ok.Then the last question:how to divide an object into two parts during the game?

I know how this should happen, but the problem is that I can not write this script.
 

Advertisement

You need to know that cutting a object for real isn't only difficult but games don't like doing it in real time; that is why Metal Gear Rising was so special when it released.

Often breaking objects in games is fake. The object is replaced by broken pieces that don't actually break realistically.

So the question is do you want the "Fake" or "Cut" way of doing this.

 

To Fake it.

Create your tree model. Then make broken tree parts. When the tree is hit, just destroy it and load in the broken pieces.

 

To Cut it.

Make the tree model.

Most commonly a ray trace is done to slice the mesh. The points where the mesh intercepts is calculated using vector math. Using these stored points and the original mesh you make two new meshes. You need to know VectorsDotProduct and CrossProduct to do this.

After the two new meshes is made you need to fill any holes because meshes are just shells, You also need to calculate there UV map again. The filling should also be UV mapped.

Apply physics to the new meshes and done. Don't keep them in the memory long because these kinds of meshes can quickly use up resources.

 

Edit:

Looking at Lumberyard Tycoon, they faked it. The model isn't 1 model it is lots of small models and when you hit one it breaks at that point.

So where it breaks was decided before you chop the tree.

Wow!Thank you so much.That's what I was looking for

This topic is closed to new replies.

Advertisement