Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Change obi rope attachment target realtime with script
#2
(06-10-2023, 03:26 PM)Adammm Wrote: Hey! I was trying to change obi rope attachment the other day with script, and I couldn't make it happen. Whenever I do it manually in the inspector while playing the rope snaps to the new target position.

Hi,

Attachments should not snap to a new position when changing their target, there's nothing in their code that enforces this. By default they just attach particles at their current position relative to the target:
http://obi.virtualmethodstudio.com/manua...ments.html

Quote:It's important to realize that attachments do not move the particle group to the position of the target object, nor the target object to the position of the particle group. Moving the particle group to the target's position would collapse all particles into a single point, and would result in a kickback effect once the particles spring back to their original positions. Moving the target could cause a whole palette of issues depending on your game logic.

Instead, particles in the group are attached at their current position relative to the target object. This makes it simple to work with multiple particles, and ensures smooth attachments with no initial "jumps" or sudden motions.

If you want particles attached at a specific position other than their position at the time of creating the attachment, you can set their position at runtime before creating the attachment: see scripting particles.

(06-10-2023, 03:26 PM)Adammm Wrote: But if I do it with script (just change the attachment script target to new transform), it changes the target but won't change the position nor do anything. 

If you want to change the position of the particles before attaching them, you need to do that manually. See:
http://obi.virtualmethodstudio.com/manua...ments.html

kind regards.
Reply


Messages In This Thread
RE: Change obi rope attachment target realtime with script - by josemendez - 09-10-2023, 07:26 AM