23-03-2020, 10:02 AM
(This post was last modified: 23-03-2020, 10:13 AM by josemendez.)
(23-03-2020, 09:15 AM)Urbem Wrote: I need create rope like this:
Without using a Render mesh, only the Obi Rope Extrudet Renderer. No compression on both axes (only one axis)
Hi,
So actually you only need a certain section of the rope to be compressed (not the whole rope), smoothly merging with the surrounding rope, and for some reason you cannot/don't want to use the ObiRopeMeshRenderer to achieve it, right? In that case, you'd need to implement your own renderer from scratch, or modify the extruded renderer.
There's several possible routes you could go:
Method #1:- If you don't need precise per-control point control, you could simply scale the extruded shape along one axis in ObiRopeExtrudedRenderer, using the current curve frame count as an approximate way to determine where you are along the rope length. Multiplying scaledNormal or scaledBinormal by a 0-1 factor in the inner loop of the UpdateRenderer() method will accomplish this.
This is the easiest way to do it, but you won't be able to precisely control where the "flat" zones appear.
Method #2:- Provided that you don't need to use vertex colors, you could repurpose control point color (which is already interpolated across particles) to a 2D "axial scale" of "flatness" value, using it to drive mesh extrusion in the renderer. This does not require you to mess with the ObiPath (spline) implementation, but still lets you control flatness using the path editor. All you'd need to do is interpret curve[i].color as a 2D scale factor in the renderer, do something like:
Code:
scaledNormal *= curve[i].color.r;
scaledBinormal *= curve[i].color.g;
This will interpret the red channel as the normal scale, and the green channel as the binormal scale. Editing flatness in the path editor will be awkward though, as you'd need to think of control point color values as vectors.
Method #3:- You could add an entirely new per-control point "flatness" or "axial scale" property, and use that to drive mesh extrusion instead. This would require you to modify the ObiPath, ObiPathFrame and ObiPathEditor classes, to include the new per-control point property. This is the best, most flexible, tightly integrated method, but requires pretty in-depth knowledge though. Don't recommend it unless you're good at reading/interpreting code and don't mind getting your hands dirty.
Keep in mind though, that ropes do not model torsion, so you have no control over rotation around the longitudinal axis. This is not a problem if your rope section is radially symmetric, but yours isn't. If you need control over torsion, a rod should be used instead of a rope.