Help problem of particle position - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Help problem of particle position (/thread-2661.html) |
problem of particle position - FZMv587 - 23-12-2020 Hi bro. I make a rope and move it in runtime. Now,i want to get some particles world position but i failed. I use Code: actorIndex = rope.blueprint.groups[0].particleIndices[0] And i use Code: solverIndex = actor.solverIndices[actorIndex] Finally,i use Code: position = actor.GetParticlePosition(solverIndex); Problem is this position is not change when i move rope, so i think maybe it is a local position. Could you help me to get world position of particle? Think you,waiting for you repose. RE: problem of particle position - josemendez - 23-12-2020 Hi there, Works fine for me, using the exact same code you posted: Code: using UnityEngine; RE: problem of particle position - FZMv587 - 23-12-2020 Hi,it ‘s me Is the particle's world position are calculated by rope.gameObject.transform? Because I use particleAttachment connect a particle group to the rope self, i move rope's position to move particles set like this: Code: rope.GetComponents<ObiParticleAttachment>()[0].target = rope.gameObject.transform; Code: Vector3 to_new_position = new Vector3(0.0f, 0.0f, 1.0f); RE: problem of particle position - josemendez - 23-12-2020 (23-12-2020, 03:04 PM)FZMv587 Wrote: Hi,it ‘s me Particles are simulated in solver space. To convert to world-space, they're transformed using the solver's transform. When you attach a particle to a target transform, the particle position at the time of setting the attachment's target/particleGroup is stored expressed in the target's local space. At runtime, this target-space position is converted to solver space and used to set the particle's position. Hope this makes sense! |