Cables mess :: fix overlap

   1760   0   1
User Avatar
Member
230 posts
Joined: 10月 2009
Offline
I want to create a procedural cable mess which is working fine but the tricky part is to fix procedurally the intersection of the cables when they are close. I have attache a complete example of my cable mess setup which includes my attempts to address this problem.

I am using two loops, the first loop in every cable carve and the second in every point of the current carve (loop in a loop). Then each point using a point cloud the points of the other carves in order to find the nearest point, its position and the distance from it. In a second vopsop I am using these info to find if the distance is less than the radius*2 of the cable then move equally the two points away. The right way to do it will be to substrate the distance from the given radius, then divide it and translate the current point in that amount and getting the direction vector by (nearPointPosition - currentPointPosition).

Pseudocode:

for each carve in the carves
for each point in the carve
find near point
if nearPoint less than (cableRadius*2)
then
float tranf = ((cableRadius*2) - nearPointDistance)/2
vector dir = (nearPointPosition - currentPointPosition)
move point
else
keep current point
end loop
end loop


1) I am not sure how to move the point based on the above idea using the direction vector. (now I am moving in z axis)
2) It seems a bit slow when there are a lot of cables is there any way to make it faster based on what I have in the attached scene?
3) Any better other way to fix this?

thanks in advance for any help

Attachments:
cables_mess.hip (235.3 KB)

  • Quick Links