In any case, I have tried working through the tutorials with respect to Newton, but I have not been able to find any that work. I believe some are out of date, others just don't compile and I have no idea why.
The following is my code. It compiles and works... I can wonder around the map and bash into walls. Therefore, it is my belief that both Irrlicht and Newton are correctly installed and linked.
Code: Select all
#include "stdafx.h"
#include <irrlicht.h>
#include <newton.h>
#include <iostream>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(lib, "Newton.lib")
int main() {
IrrlichtDevice* device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(640, 480), 16, false, false, false);
// Could not create selected driver.
if (device == 0) { return 1; }
video::IVideoDriver* driver = device -> getVideoDriver();
scene::ISceneManager* smgr = device -> getSceneManager();
// Load the map.
device -> getFileSystem() -> addZipFileArchive("media/map-20kdm2.pk3");
scene::IAnimatedMesh* level = smgr -> getMesh("20kdm2.bsp");
scene::ISceneNode* node = smgr -> addOctTreeSceneNode(level -> getMesh(0), 0, -1, 128);
scene::ITriangleSelector* selector = smgr -> createOctTreeTriangleSelector(level -> getMesh(0), node, 128);
node -> setTriangleSelector(selector);
selector -> drop();
// Load the camera.
scene::ICameraSceneNode* camera = smgr -> addCameraSceneNodeFPS(0, 100.0f, 300.0f, -1, 0, 4, true);
node -> setPosition(core::vector3df(-1350, -130, -1400));
camera -> setPosition(core::vector3df(-100, 50, -150));
scene::ISceneNodeAnimator* anim = smgr -> createCollisionResponseAnimator(
selector, camera, core::vector3df(30, 50, 30),
core::vector3df(0, -1.5f, 0),
core::vector3df(0, 50, 0));
camera -> addAnimator(anim);
anim -> drop();
device -> getCursorControl() -> setVisible(false);
while (device -> run()) {
if (device -> isWindowActive()) {
driver -> beginScene(true, true, 0);
smgr -> drawAll();
driver -> endScene();
}
}
device -> drop();
return 0;
}
About all I have accomplished with Newton is the use of ...
Code: Select all
NewtonWorld nWorld = NewtonCreate(NULL, NULL);
My thanks in advance.