radiatoryang / hedera

paint 3D ivy in the Unity Editor, watch procedurally generated meshes simulate growth and clinging in real-time
GNU General Public License v2.0
783 stars 64 forks source link

Leaf Position is incorrect #5

Closed danwipf closed 4 years ago

danwipf commented 5 years ago

Incorrect results when using the Tool. (see the Leafs) any quick Idea how to fix this issue? (it's the ExampleIvyMeshExport.obj file inside the Example folder)

Hedera Leaf position

radiatoryang commented 5 years ago

I would probably want to look into this deeper / make leaf placement more user-configurable, but unfortunately I won't have time to work on this for a while...

some workarounds to try:

danwipf commented 5 years ago

i did tried to change the textures(rotation), manually add offset to the leafs didnt messed with the uv, because i believe they do not catch a point on the root/branch.

just to clarify i know how to manipulate a spline and can calculate a point on it but i didn’t figure out yet how it works here.

radiatoryang commented 5 years ago

https://github.com/radiatoryang/hedera/blob/b77406ca57132b6295c498b3a9a963917c33c1aa/Editor/Scripts/IvyMesh.cs#L424

it picks a point on the branch, adds random offset, and then uses that point as the center of the leaf quad...

a more accurate method maybe wouldn't add any random offset to the center -- and instead it would generate the leaf quad based on a random rotation around a pivot point, instead of the center of the leaf quad

(feel free to submit a PR if you get it working! or I'll get around to this in ~december)

danwipf commented 5 years ago

yes i will.

right now i can say that newLeafPos - ivygraphs current root position is an actual and correct point, so somewhere inside the center’s calculation the position gets off.

next respon i’ll add the solution as PR

dan

radiatoryang commented 4 years ago

finally got around to this a year later! see PR #8