Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Teleport rope particles to wordspace positions in runtime
#1
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?
Reply
#2
(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?
Reply
#3
(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/tutor...icles.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.
Reply
#4
(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/tutor...icles.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?
Reply