Obi Official Forum

Full Version: Remove Initial Target Offset: Attachments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, 
I have a single rope and two Particle Attachments. 

My issue is that if the Transforms of the Target, for the ObiParticleAttachment are not at the exact position of the ends of the rope, then obi rope does not update to the target position, but the target position + that initial offset. 

Can I snap the rope particle group, attachment position to the target position, in other words, remove the offset? 


Thank you
(13-04-2023, 04:19 PM)Renman3000 Wrote: [ -> ]Hi, 
I have a single rope and two Particle Attachments. 

My issue is that if the Transforms of the Target, for the ObiParticleAttachment are not at the exact position of the ends of the rope, then obi rope does not update to the target position, but the target position + that initial offset. 

Can I snap the rope particle group, attachment position to the target position, in other words, remove the offset? 


Thank you
Hi!

This is the intended behavior, as explained in the manual:
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.

If you want to remove the offset, you have to either:
A) move the target transform to the attachment position.
B) move the attached particle to the target transform's position.

Or any combination of both (move both the attached particle and the transform to their average position, for instance). Afterwards, create the attachment.

You can get/set individual particle positions using the particles API, and you can retrieve the index of the particles involved in the attachment by reading the "indices" array of the particle group (In the case of a rope, there's always only one particle per particle group).

kind regards,
(14-04-2023, 07:50 AM)josemendez Wrote: [ -> ]Hi!

This is the intended behavior, as explained in the manual:
http://obi.virtualmethodstudio.com/manua...ments.html


If you want to remove the offset, you have to either:
A) move the target transform to the attachment position.
B) move the attached particle to the target transform's position.

Or any combination of both (move both the attached particle and the transform to their average position, for instance). Afterwards, create the attachment.

You can get/set individual particle positions using the particles API, and you can retrieve the index of the particles involved in the attachment by reading the "indices" array of the particle group (In the case of a rope, there's always only one particle per particle group).

kind regards,


ok, thank you.

- my aim tho, just so you know is to use a number of standard prefabs whose varitions (in posisitions) could be set at runtime. 
Under this I must set by hand each. 

Could the system not pause to adjust before any particle firing occurs?
Anyhow, thank you for your help.
(17-04-2023, 01:19 PM)Renman3000 Wrote: [ -> ]Could the system not pause to adjust before any particle firing occurs?


Sorry, I don't understand what you mean by the system "pausing" or what "particle firing" is.



[quote='Renman3000' pid='14194' dateline='1681733963']
- my aim tho, just so you know is to use a number of standard prefabs whose varitions (in posisitions) could be set at runtime. 

Do you mean you want to create a rope that goes from point A to point B, both chosen at runtime? you can do that too, by creating the rope blueprint at runtime. See: http://obi.virtualmethodstudio.com/manua...ctors.html

kind regards,