WebGL experiment part 3

2013-09-29 Last modified on 2021-05-24

Intro

A very small update from part 2.

We will only rotate our elements.

Polygons and rotation (image from NeHe website)

The demo page is here and the code is here.

Function drawStuff

We will create our elements as usual, and then apply rotation on them

Triangle rotation

Square rotation, along y axis:

var triangle = drawTriangle(scene);
triangle.rotation = new BABYLON.Vector3(0, -Math.PI/4, 0);

Square rotation, along x axis:

var square = drawSquare(scene);
square.rotation = new BABYLON.Vector3(Math.PI/4, 0, 0);

The end

You will find more information about rotation and scaling on this BabylonJS tutorial.

Next lesson will be about creating 3d objects. OH YEAH.