Monday, April 21, 2014

Scripting Ideas

10 Ideas for Python scripts:

  1. Button that creates a cube at a specified size, specifically 160x8x160, moves pivot to the bottom/corner of the mesh, and moves pivot to origin point
    1. could also make UI with different possible sizes, like 320x8x320
    2. wall that comes with 4 subdivisions already--or can set subdivisions!
    3. adding idea #2 in
    4. also add a button to duplicate the mesh a specified amount of times and space them out--good for making modular adjustments
  2. Button that creates a sphere with good topology from mesh>smoothing a cube.
  3. Button that sends pivot to the origin, deletes history, freezes transformation, and exports
  4. Button that selects all vertices on a mesh and wields them together
  5. Script that cuts an edge between two selected vertices
  6. Script that moves pivot point to a specific point on the mesh
  7. script that sends encouraging messages when maya autosaves
  8. script that duplicates a mesh a certain amount of times and spaces them out
  9. script that extracts a selected face a specified distance
  10. script that deletes all meshes in the scene


This is my current pseudocode:

import maya.cmds as cmds
import logging

Input = value of input bar

def generateToolbarUI():
    window_name = "ToolboxUI"
    
    if cmds.window(window_name, q=True, exists = True):
        cmds.deleteUI(window_name)
        
    my_window = cmds.window(window_name, title = "Collision Tools")
   
    
    cmds.columnLayout(adj=True)
    
    cmds.button(label="Basic Wall", c=generateBasicWall)
    cmds.button(label="Divided Wall", c=generateDivided)
    cmds.button(label="Box", c=generateDoubledWall)
    cmds.button(label="Generate Sphere", c=generateDoubledWall)


    cmds.showWindow(my_window)
    
    
def generateBasicWall(unused=None):
    generateWall("basic")
def generateDoubledWall(unused=None):
    generateWall("doubled")
def generateSphere(unused=None):
    generateSphere("sphere")
def generateDivided(unused=None):
    generateWall("divided")

#creates a cube with the exact dimensions of 8x160x160

def generateWall(mode="b"):
    
    #creates a cube with the exact dimensions of 8x160x160
    if mode == "basic":
        cmds.polyCube(w=8, d=160, h=160)
        this line will send pivot to bottom
        this line will send pivot & mesh to origin
        
    #doubles measurements of wall    
    if mode == "doubled":
        cmds.polyCube(w=8, d=160*input, h=160*input)
        this line will send pivot to bottom
        this line will send pivot & mesh to origin
        
    #created a cube with 4 divisions in depth and height    
    if mode == "divided":
        cmds.polyCube(w=8, d=160, h=160, sd=4, sh=4)
        this line will send pivot to bottom
        this line will send pivot & mesh to origin
def generateSphere(mode="c"):
    
    if mode == "sphere":
        #creates a 30x30x30 square
        cmds.polyCube(w=30, d=30, h=30)
        #smooths cube by 2 subdivisions to create a sphere with good topology
        cmds.polySmooth(dv = 2)

def export():
    selection = ls(sl=True)
    if nothing selected
        displayerror saying "Please Select Something!"
    this line will center the pivot
    this line deletes history
    this line freezes transformation
    this line opens the exportwindow
    this line exports the mesh as an .fbx

Sunday, April 13, 2014

Attract Trailer Research

For the Attract Trailer assignment, the first thing we had to do was go out and find an example of a real life attract trailer (featuring in-game footage only). I found the one for Need for Speed Rivals:



What makes it cool? Well, for one thing, the music is pretty awesome, and it's cut well. The trailer also demonstrates a lot of the mechanics of the game: jumping, crashing into other cars, etc. Also explosions and dust particles, can't forget those.

Thursday, April 3, 2014

UI

Our racing levels are almost done. All that's left (besides final adjustments) is the UI. For inspiration, I looked at some published games:







...as well as the speedometer of the car I modeled. For this, I looked at both the 1965 Mini Cooper and a more modern one:





This is the first pass of my HUD. The orange circle will be the boost indicator, and the tree shape will have the lap times overlaid. It's subject to change, but I like where it's going.