Is there a way to bend a cylinder to make it look curved in Milkshape 3D?
If so, how?
If so, how?
SeedRnd MilliSecs() Graphics3D 640,480,16,2 SetBuffer BackBuffer() camera = CreateCamera() light = CreateLight() sphereOne = CreateSphere(20) sphereTwo = CreateSphere(20) PositionEntity sphereOne,Rand(10,20),0,Rand(10,20) PositionEntity sphereTwo,Rand(0,20),0,Rand(10,20) connecter = CreateBendyPipe(sphereOne,sphereTwo) Repeat Cls x# = 0 y# = 0 z# = 0 If KeyDown(203) = True Then x#=-0.1 If KeyDown(205) = True Then x#=0.1 If KeyDown(208) = True Then y#=-0.1 If KeyDown(200) = True Then y#=0.1 If KeyDown(44) = True Then z#=-0.1 If KeyDown(30) = True Then z#=0.1 MoveEntity camera,x#,y#,z# UpdateWorld RenderWorld Flip Until KeyDown(1) Function CreateBendyPipe(entityOne,entityTwo) distance# = EntityDistance(entityOne,entityTwo) brush = CreateBrush(255,194,14) segments = 5 ang = -20 x# = 0 bendyPipeEntity = CreateCylinder(100) PaintMesh bendypipeentity, brush RotateMesh bendypipeentity,0,0,ang For loop = 1 To segments-1 segEntity = CreateCylinder(100) ang = ang + segments Select(loop) Case 1 x# = x# + 0.54 Case 2 x# = x# + 0.399 Case 3 x# = x# + 0.215 Case 4 x# = x# + 0.065 End Select RotateMesh segentity,0,0,ang PositionMesh segEntity,x#,(loop*MeshHeight(segentity)-(x-ang/100)-0.2),0 PaintMesh segentity, brush AddMesh(segentity,bendypipeentity) FreeEntity segentity Next copiedMesh = CopyMesh(bendypipeentity) RotateMesh copiedMesh,0,180,180 PositionMesh copiedMesh,0,15,0 AddMesh copiedMesh,bendypipeentity FreeEntity copiedmesh FitMesh bendypipeentity,0,0,0,.8,distance#,.8 PositionEntity bendypipeentity,EntityX#(entityOne),EntityY#(entityOne),EntityZ#(entityOne) angleTodestinationEntity# = AngleBetween2Points#(EntityX#(entityOne),EntityZ#(entityOne),EntityX#(entityTwo),EntityZ#(entityTwo)) RotateEntity bendypipeentity,180,angleTodestinationEntity#,270 Return bendypipeentity End Function Function AngleBetween2Points#(x1#,y1#,x2#,y2#) angle# = ATan2(y1#-y2#,x1#-x2#)-180 If angle# < 0 Then angle# = 360 + angle# If angle# > 359 Then angle# = 360 -angle# Return angle# End Function