Exemplo n.º 1
0
def drawLine(lineID, line):
    lineID = "line" + str(lineID)
    length = alg.calcDistance(line.startPos, line.endPos)
    yaw = m.radians(alg.calcAngleTo(line.startPos, line.endPos))
    hsc.write(lineID + " = Instantiate(line," + hsc.vf(line.startPos) + "," +
              hsc.qf(yaw) + ");")
    hsc.write(lineID + ".transform.localScale = " + hsc.vf([0, length, 0]) +
              ";")
Exemplo n.º 2
0
def unityUpdateObj(objID, objPos, objYaw):
    """updates the position and rotation of an object in unity
    input:
        objID: int
        objPos: vector (list)
        objRot: quaternion (tuple)
    """

    hsc.write(
        hsc.makeID(objID) + ".transform.position = " + hsc.vf(objPos) + ";")
    hsc.write(
        hsc.makeID(objID) + ".transform.rotation = " + hsc.qf(objYaw) + ";")
Exemplo n.º 3
0
def unitySpawn(objID, prefab, pos, yaw, scale=1):
    """creates a GameObject in unity from the prefab at the indicated pos and rot
    input:
        script: list of lists
        objID: int
        prefab: string
        pos: vector (list)
        rot: quaternion (tuple)
        scale: int, defaulted to 1
    """

    if prefab == "wall":
        scaling = [mv.WALL_WIDTH, scale, mv.WALL_HEIGHT]
    else:
        scaling = [scale, scale, scale]
    hsc.write(
        hsc.makeID(objID) + " = Instantiate(" + prefab + "," + hsc.vf(pos) +
        "," + hsc.qf(yaw) + ");")
    hsc.write(
        hsc.makeID(objID) + ".transform.localScale = " + hsc.vf(scaling) + ";")
    if objID > hsc.maxID[0]:
        hsc.maxID[0] = objID
Exemplo n.º 4
0
def unityDestroy(objID):
    """destroys a gameobject in unity
    input:
        objID: int
    """
    hsc.write("Destroy(" + hsc.makeID(objID) + ");")
Exemplo n.º 5
0
def destroyLine(lineID):
    lineID = "line" + str(lineID)
    hsc.write("Destroy(" + lineID + ");")