I started playing with AngelScript yesterday and of course, found my first problem:
[Tue Nov 25 07:49:46 2014] ERROR: Scripts/keyw.as:11,2 - Exception 'Null pointer access' in 'void Start()'
AngelScript callstack:
Scripts/keyw.as:void Start():11,2
This is the main code:
[code] #include “Scripts/Engine/IsoCamera.as”
Scene@ gameScene;
IsoCamera@ cam;
void Start()
{
gameScene = Scene(“castle-gates”);
gameScene.LoadXML(cache.GetFile(“Scenes/NinjaSnowWar.xml”));
cam = IsoCamera(); <----- This is the error line
if (!engine.headless)
{
renderer.viewports[0] = Viewport(gameScene, cam.gameCamera);
}
}
[/code]
This is the camera creation code:
[code]class IsoCamera
{
IsoCamera()
{
target = Node();
camNode = target.CreateChild(“camnod”);
gameCamera = camNode.CreateComponent(“Camera”);
camNode.position = Vector3(0, 55, 52);
camNode.LookAt(target.position);
}
void SetPosition(Vector3 pos)
{
target.position = pos;
}
Node@ target;
Node@ camNode;
Camera@ gameCamera;
}[/code]
Can somebody seee where is my mistake?