Runtime Rope Generation - 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: Runtime Rope Generation (/thread-3216.html) |
Runtime Rope Generation - mnholbart - 04-12-2021 First off this all works fine if generated in editor beforehand. If I create a rope and hit play it works just fine with my procedurally generated Obi Colliders. However if I generate my rope at runtime there seems to be no recognition of the Obi Colliders. The way I have generated the ropes is basically like so, I pretty much copied the documentation from the website. What am I missing to get them to partake in the physics system? Code: var blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>(); Thanks RE: Runtime Rope Generation - josemendez - 06-12-2021 Hi, You need to pass appropriate collision filters to your control points. right now you're just passing "1" as the filter, which may or may not generate collisions depending on the filters set on your colliders. Check out "collision filtering" in the manual: http://obi.virtualmethodstudio.com/manual/6.3/collisions.html Also check the AddControlPoint function in the API docs. You can either build your filters manually using bitwise operators, or use Obi's MakeFilter() helper function. Filters are made of a mask and a category. The mask is the first parameter of the ObiUtils.MakeFilter() function. Just keep in mind the mask is a bit mask (just like Unity's layer masks), so you build it by simply or'ing together bits. For instance, to build a mask that collides with categories 1, 3, and 6: Code: int mask = (1 << 1) | (1 << 3) | (1 << 6); If you want a filter that collides with everything: Code: int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0); Note you need to be familiar with bitwise operators to understand this. If you're not sure what this means, look them up. There's many tutorials around dealing with bit manipulation (in C# as well as other languages), the above link to Unity's layer masks is a good starting point as they work just like Obi's filter masks. RE: Runtime Rope Generation - mnholbart - 06-12-2021 Ok thanks, I reverted my branch and stopped working with it for now but will try it in the future. I suggest you amend the tutorial on your website to include this information you've given me @ http://obi.virtualmethodstudio.com/manual/6.3/scriptingactors.html RE: Runtime Rope Generation - Reydans - 07-12-2021 Hi, I just had the exact same problem this morning, so i had to thank you for this well-timed reply. I did set the filter to one aswell, but it turns out it sets its category on 0 but its collider mask to collide with nothing. this works better now, Thanks! |