Obi Official Forum
Create rope from code - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Create rope from code (/thread-3117.html)



Create rope from code - lacasrac - 03-10-2021

http://obi.virtualmethodstudio.com/forum/thread-2978.html

I saw this source code, very good, but I have one probleme with it.
The collision is never happening because the collision is set to Nothing on this rope.
Any way to set up from code that variable to 'Everything'? Thanks


RE: Create rope from code - josemendez - 04-10-2021

(03-10-2021, 02:26 PM)lacasrac Wrote: http://obi.virtualmethodstudio.com/forum/thread-2978.html

I saw this source code, very good, but I have one probleme with it.
The collision is never happening because the collision is set to Nothing on this rope.
Any way to set up from code that variable to 'Everything'? Thanks

If you're using 6.2, make sure you pass appropriate collision filters to the AddControlPoint() method when generating the rope path.

Filters are a 32-bit integer where the 16 most significant bits define the collision mask, and the 16 less significant bits define the category. See collision filtering: http://obi.virtualmethodstudio.com/manua...sions.html)

You can build the filter yourself using bitwise operations, and there's also helper functions if you don't want to mess with bits yourself. ObiUtils.MakeFilter will create the filter for you given a mask and a category. For instance:


Code:
int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything,0);

This builds a filter for category 0 that collides with everything. You then pass this to the "filter" parameter in the AddControlPoint function.


RE: Create rope from code - lacasrac - 04-10-2021

Thanks, I tried everything, but this solution is the good solution. You are my hero Sonrisa