Docs for Version: 1.0a
Show:
Module: Game

Main class for creating objects in aexolGL engine. Takes care for connecting RenderTree objects.

Constructor

GameObject

(
  • scene
)

Parameters:

  • scene Scene

    scene where GameObject exists

Example:

world = new Scene();
                                gshader = new basicShader()
                                skyMat = new Material({color:[0.4,0.7,1],shininess:13.0,specularWeight:0.0  })
                                skyMesh = Mesh.sphere().scale(30.0,10.0,30.0)
                                someLight = new Light({
                                       lightPosition: new Vector(1.3,4.0,-2.0),
                                       attenuation: 40.0,
                                       intensity: 1.33,
                                       color: [0.8,1.0,1.0]
                                   })
                                sky = new GameObject(world,{
                                       shader:gshader,
                                       material:skyMat,
                                       mesh:skyMesh,
                                       light:someLight
                                   })

Methods

addAnimation

(
  • animation
)

Adds animation to GameObject

Parameters:

move

(
  • x
  • y
  • z
  • r
)

Move the object

Parameters:

  • x Float

    Move in x axis

  • y Float

    Move in y axis

  • z Float

    Move in z axis

  • r Boolean

    Move relative to actual position

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            //absolute move
                                            game.move(0,1,0)
                                            //relative move
                                            game.move(0,1,0,1)

remove

()

Removes GameObject

rotate

(
  • x
  • y
  • z
  • r
)

Rotate the object (degrees)

Parameters:

  • x Float

    Rotate in x axis

  • y Float

    Rotate in y axis

  • z Float

    Rotate in z axis

  • r Boolean

    Rotate relative to actual rotation

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            //absolute rotate
                                            game.rotate(0,1,0)
                                            //relative rotate
                                            game.rotate(0,1,0,1)

scale

(
  • x
  • y
  • z
  • r
)

Scale the object

Parameters:

  • x Float

    Scale in x axis

  • y Float

    Scale in y axis

  • z Float

    Scale in z axis

  • r Boolean

    Scale relative to actual scale

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            //absolute scale
                                            game.scale(1.2,1.2,1.3)
                                            //relative scale
                                            game.scale(0,1,0,1)

scaleUniform

(
  • f
  • r
)

Scale the object uniform in all axes

Parameters:

  • f Float

    Scale factor

  • r Boolean

    Scale relative to actual scale

setModelView

()

Replace modelView in RenderNode

Properties

aex

Aex

Aex connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.aex = new Aex()

light

Light

Light system connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.light = new Light({})

material

Material

Material connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.material = new Material({})

mesh

Mesh

Mesh connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.mesh = Mesh.sphere()

position

Vector

Position of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.position = new Vector(1.0,2.0,3.0)

rotation

Vector

Rotation of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.rotation = new Vector(0.0,90.0,0.0)

rotX

Float

x Rotation of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.rotX = 20.0

rotY

Float

y Rotation of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.rotY = 20.0

rotZ

Float

z Rotation of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.rotZ = 20.0

scaleX

Float

x scale of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.scaleX = 2.0

scaleY

Float

y scale of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.scaleY = 2.0

scaleZ

Float

z scale of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.scaleZ = 2.0

shader

Shader

Shader connected to this game object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.shader = new Shader({})

uniforms

Dict

Uniforms of object

Example:

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.uniforms["tiling"] = [1.0,10.0]
                                            

You can also set uniforms of the material easily

world = new Scene()
                                            game = new GameObject(world,{...})
                                            game.uniforms["color"] = [1.0,0.0,0.0]
                                            game.uniforms["alpha"] = 0.2

x

Float

x Position of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.x = 20.0

y

Float

y Position of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.y = 20.0

z

Float

z Position of object

Example:

world = new Scene()
                                            game = new GameObject(world,{})
                                            game.z = 20.0