Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Adding & Removing ObiParticleAttachments at runtime
#2
Hi Martin,

Tested your code, and it works as it's supposed to: attachments work by binding the particle at its current position, relative to the transform they're being bound to. So if you destroy the attachment, let the actor simulate, and then re-create the attachment, the particle will be attached at whenever it is at that moment.

If you need to attach the particle to a specific point in an object's local space, you have several options:

1.- Set the particle position before creating the attachment.

2.- Set the particle position and manually set its inverse mass to 0 (this is what a static attachment does under the hood). Also, see the ObiContactGrabber.cs utility script for an example of how to do this: the contact grabber detects collisions between particles and colliders, then attaches the particle to the collider.

3.- Manually create a pin constraint, passing the offset in local space to the AddConstraint() method.



Let me know if you need further help with any of these.
Reply


Messages In This Thread
RE: Adding & Removing ObiParticleAttachments at runtime - by josemendez - 05-03-2021, 12:55 PM