(11-08-2022, 06:24 PM)littleanchovy Wrote: [color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]Hey,!, i am using obi rope and i wanted to ask that. Currently i am using sneak scene and i want to wrap an object with my snake and in scripts i want to know if a sneak is currently wrapping an object.I've checked forums and documentations but unfortunately i couldnt find answers.
Hi,
Obi exposes ways to read/write all per-particle properties such as position, velocity or radius:
http://obi.virtualmethodstudio.com/manua...icles.html
Also, it has an API to perform spatial queries (recasts, box/sphere overlaps, etc):
http://obi.virtualmethodstudio.com/manua...eries.html
and a way to retrieve particle-collider contacts and particle-particle contacts:
http://obi.virtualmethodstudio.com/manua...sions.html
However, it doesn't have any built-in way to know if a rope is "wrapped" around an object, since the concept of "wrapped" can vary a lot depending on the game: does it mean the rope is circling around an object, without touching it? how close to a circle must its shape be? or does it mean the rope is in contact with the object?what percentage of the rope must be in contact with the object for us to consider it wrapped? etc.
In your specific case, seems like it's enough for the rope to form a circle around an object? In that case, you could get the particle positions relative to the object, convert them from cartesian to polar coordinates, and just make sure their angles increase monotonically (the angle for the next particle in the rope is always larger than the angle of the previous one). If they do, that would mean rope particles roughly form a circle around the object.
kind regards,