Ejemplo n.º 1
0
 def getCurveSegmentLength(self):
     pointA = Vector3(
         cmds.pointPosition(self.curveName + '.cv[0]')[0],
         cmds.pointPosition(self.curveName + '.cv[0]')[1],
         cmds.pointPosition(self.curveName + '.cv[0]')[2])
     pointB = Vector3(
         cmds.pointPosition(self.curveName + '.cv[1]')[0],
         cmds.pointPosition(self.curveName + '.cv[1]')[1],
         cmds.pointPosition(self.curveName + '.cv[1]')[2])
     return Vector3.getDistanceBetweenTwoPoints(pointA, pointB)
Ejemplo n.º 2
0
    def createDoorWalls(self, sideDoorPoint, curveExtremityPoint,
                        wallGroupName, curveName):
        wallsSegmentNames = []
        segmentLength = Vector3.getDistanceBetweenTwoPoints(
            sideDoorPoint, curveExtremityPoint)
        #Get amont of wall we need
        wallsNeeded = int(math.ceil(segmentLength / self.getWallSize().x))
        #curve = cmds.curve(p=[(sideDoorPoint.x,sideDoorPoint.y,sideDoorPoint.z),(curveExtremityPoint.x,curveExtremityPoint.y,curveExtremityPoint.z)],d=1,n=curveName)
        vec1 = Vector3(sideDoorPoint.x, sideDoorPoint.y,
                       self.center.z) - sideDoorPoint
        vec2 = curveExtremityPoint - sideDoorPoint
        angle = Vector3.getAngleBetweenVector(vec1, vec2)
        spawnPointA = sideDoorPoint
        spawnPointB = curveExtremityPoint

        for j in range(0, wallsNeeded):
            spawnWallPosition = Vector3(
                spawnPointA.x -
                (spawnPointA.x - spawnPointB.x) * j / wallsNeeded -
                (spawnPointA.x - spawnPointB.x) / wallsNeeded / 2,
                spawnPointA.y -
                (spawnPointA.y - spawnPointB.y) * j / wallsNeeded -
                (spawnPointA.y - spawnPointB.y) / wallsNeeded / 2,
                spawnPointA.z -
                (spawnPointA.z - spawnPointB.z) * j / wallsNeeded -
                (spawnPointA.z - spawnPointB.z) / wallsNeeded / 2)

            yRotation = 0.0
            if sideDoorPoint.x > curveExtremityPoint.x:
                yRotation = -90.0 + angle
            else:
                yRotation = 90.0 - angle

            wall = self.createWall(spawnWallPosition,
                                   Vector3(0.0, yRotation, 0.0))
            self.walls.append(wall)
            wallsSegmentNames.append(wall.name)

        cmds.group(wallsSegmentNames, n=wallGroupName)
        cmds.xform(wallGroupName, piv=(0, 0, 0))
        self.IncrementWallsSegmentIndex()