12-10-2021, 12:59 PM
hi, I want to increase the size of the ends of my rope as shown below.
My code is as follows.
While this scales up the particle, the particle does not scale uniformly as shown in the image above.
My rope is rendered on a secondary camera that using a culling mask and camera clear flags set to "Depth Only", so that my ropes always render infront of all other objects.
goal is that I want the ends of the rope to be scaled up and face the camera always, so it looks clear and uniform. (As shown in the above image)
How can I achieve that effect?
My code is as follows.
Code:
var active_Rope = rope;
if (active_Rope == null || solver == null)
return;
// index of the first particle in the actor:
int FirstParticle = 0;
int LastParticle = active_Rope.activeParticleCount - 1;
int SecondParticle = 1;
int SecondLastParticle = active_Rope.activeParticleCount - 2;
Vector3 EndsShape = Vector3.one;
solver.principalRadii[active_Rope.solverIndices[FirstParticle]] = EndsShape * RopeEndsThickness;
solver.principalRadii[active_Rope.solverIndices[LastParticle]] = EndsShape * RopeEndsThickness;
solver.principalRadii[active_Rope.solverIndices[SecondParticle]] = EndsShape * RopePreEndsThickness;
solver.principalRadii[active_Rope.solverIndices[SecondLastParticle]] = EndsShape * RopePreEndsThickness;
While this scales up the particle, the particle does not scale uniformly as shown in the image above.
My rope is rendered on a secondary camera that using a culling mask and camera clear flags set to "Depth Only", so that my ropes always render infront of all other objects.
goal is that I want the ends of the rope to be scaled up and face the camera always, so it looks clear and uniform. (As shown in the above image)
How can I achieve that effect?