Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How do I set a particle position at runtime ?
#9
(31-03-2020, 09:04 PM)josemendez Wrote: Took a look at the snippets, but it's confusing because there's bits missing that I'm not entirely sure how I'm supposed to fill in.

I think the overall intent of the code is to instantiate a rope at each vertex of a mesh, kinda like hair strands. Is this correct? In that case there's no need to fiddle with particles, simply setting the position/orientation of the rope should be enough.

1.- Create a rope prefab that has one end centered in the transform's origin, and is aligned with the Z axis, like this (the translation gizmo is the actual object's gizmo, not a control point). This is so that when we translate/rotate the prefab, we know that we are placing the root of the hair strand, and orienting it perpendicular to the mesh surface.

2.- Then, instantiate the prefab once per vertex using this code:

It's quite slow though. Keep in mind that simulating and generating a mesh for each individual strand is way too costly. Even when done in the GPU instead of the CPU, guide hairs/interpolation is used.  No hair system I've come across  (realtime or not) simulates each individual hair.

Thank you so much !!

I tried fiddling with the particles themselves because moving the entire rope object didn't work at all, for some reason...
I think it has to do with what you just explained, actually.

About the CPU/GPU, yes I know, but I do need them generated in realtime. I already have an idea on how to reduce the load on the processor and it's working pretty nicely. (However I still need to try on a computer that doesn't have 32gb of ram...) I have tried with ropes that I added manually, and removed most of the contraints I didn't need. Also, the scalp mesh isn't visible and only has vertices in strategic positions. I'm trying to generate as little ropes as possible and not all of them have the same size.
I need people to be able to manually move the strands, brush them down, split them, cut them, make them longer, turn them into braids, tie them up, etc... The end result is then going to be turned into a simple mesh with culling on all non visible faces from all angles, but I'm serializing the particle positions for later editing by the user.  Sonrisa I really hope I won't have too much troubles resetting those particles...  Indeciso

Thank you sooooo much for helping, I'm going to try this out and let you know! I'll add the [solved] prefix to my thread later if it works... Well, if that kind of forum allows me to edit the thread name  Lengua

Thank you so much again, Jose !!  Sonrisa Sonrisa
Reply


Messages In This Thread
RE: How do I set a particle position at runtime ? - by slugGoddess - 01-04-2020, 01:10 PM