Unity 3D

Henrik Ilgen, ActiveVB Workshop 2013

Hinweis zur Benutzung

Motivation

int main(int argc, char** argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(600, 400);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("Megacooles Spiel");
    init();

    gluPerspective(60, 600.0f / 400.0f, 0, 1000);

    glutDisplayFunc(display);
    glutIdleFunc(display);
    glutMainLoop();
    return 0;
}

Motivation

void init(void) 
{
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //glOrtho(0.0, 600.0, 0.0, 400.0, -1.0, 1.0);
}
 

void timer(int t) 
{
    angle += 30 * t;
    display();
}

Motivation

void display(void) 
{
    glClear (GL_COLOR_BUFFER_BIT);
    angle += 0.05f;

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glTranslatef(0, 0, -10.0f + (cos(angle / 180.0 * 3.141592654) + 1) / 2 * 8);
    glRotatef(angle, 0, 1, 0);

    glBegin(GL_LINE_STRIP);
        glColor3f(1, 0, 0);
        glVertex3f(-0.5, -0.9f, 0);
        glColor3f(0, 1, 0);
        glVertex3f(-0.5f, 0.0f, 0);
        glColor3f(0, 0, 1);
        glVertex3f(0.0f, 0.9f, 0);
        glColor3f(1, 1, 0);
        glVertex3f(0.5f, 0.0f, 0);
        glColor3f(1, 0, 1);
        glVertex3f(-0.5f, 0.0f, 0);
        glColor3f(0, 1, 1);
        glVertex3f(0.5f, -0.9f, 0);
        glColor3f(1, 1, 1);
        glVertex3f(-0.5f, -0.9f, 0);
        glColor3f(0, 1, 1);
        glVertex3f(0.5f, 0.0f, 0);
        glColor3f(1, 0, 1);
        glVertex3f(0.5f, -0.9f, 0);        
    glEnd();
    glutSwapBuffers();
}

Motivation

Abbildung 1: Der Code zeichnet das Haus vom Nikolaus

Inhalt

Einführung - Was kann Unity?

Einführung - Was kann Unity?

Abbildung 2 - Nemura

Einführung - Was kann Unity?

Abbildung 3 - Kerbal Space Program (Quelle: en.wikipedia.org)

Einführung - Zielplattformen

Grundlagen - Der Editor

Abbildung 4 - Der Editor von Unity nach dem Start

Grundlagen - Objekte importieren

4 einfache Schritte zum Import:

Grundlagen - GameObjects

Abbildung 6 - Der Inspector von Unity

Grundlagen - Der Szenengraph

Abbildung 7 - Die Hierarchie von Unity

Grundlagen - C#-Scripting

Abbildung 8 - Der Projektexplorer von Unity

Erster Prototyp

Zweiter Prototyp

Netzwerkfähiger Prototyp