Obi Official Forum
Help Teleport rope particles to wordspace positions in runtime - 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 Teleport rope particles to wordspace positions in runtime (/thread-2060.html)



Teleport rope particles to wordspace positions in runtime - zkkzkk32312 - 20-02-2020

I have tried rope.TeleportParticle(index, position) where position is world space without any success (teleport to random postiion).
does anyone know how if there is a easy way to turn position into local space easily?


RE: Teleport rope particles to wordspace positions in runtime - zkkzkk32312 - 21-02-2020

(20-02-2020, 05:21 PM)zkkzkk32312 Wrote: I have tried rope.TeleportParticle(index, position) where position is world space without any success (teleport to random postiion).
does anyone know how if there is a easy way to turn position into local space easily?

Idealy I wish to Teleport a particle to a world space position then lock its position by dynamically creating a Attachment for it.
Can some one help?


RE: Teleport rope particles to wordspace positions in runtime - josemendez - 22-02-2020

(21-02-2020, 05:31 PM)zkkzkk32312 Wrote: Idealy I wish to Teleport a particle to a world space position then lock its position by dynamically creating a Attachment for it.
Can some one help?

Hi there,

You can set any particle's position, velocity, mass, or any other property. See:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

So, moving a particle somewhere is just a matter of setting its position, and (optionally) zeroing out its velocity. All particle properties must be expressed in solver space, you can use Unity's InverseTransformPoint method to transform from world space to solver space (that is, the solver's local space). Let me know if you need help with the code to achieve this.

To attach the particle at runtime, make a ObiParticleGroup containing your particle (remember that particle groups are ScriptableObjects, so you must use ScriptableObject.CreateInstance to create them) and assign it to the attachment's particleGroup.


RE: Teleport rope particles to wordspace positions in runtime - ab8228657 - 02-03-2020

(22-02-2020, 09:41 PM)josemendez Wrote: Hi there,

You can set any particle's position, velocity, mass, or any other property. See:
http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

So, moving a particle somewhere is just a matter of setting its position, and (optionally) zeroing out its velocity. All particle properties must be expressed in solver space, you can use Unity's InverseTransformPoint method to transform from world space to solver space (that is, the solver's local space). Let me know if you need help with the code to achieve this.

To attach the particle at runtime, make a ObiParticleGroup containing your particle (remember that particle groups are ScriptableObjects, so you must use ScriptableObject.CreateInstance to create them) and assign it to the attachment's particleGroup.

Sir, I am not a professional code designer.  Can you teach me how to use ScriptableObject.CreateInstance  in each particle 's local space to create ObiParticleGroup?