Tumle v1.4 irrlicht/newton
Don't know if this is the right place to ask.
I have a problem assigning a node values, my code compiles without any errors or warnings, but renders nothing when runned, and displaying the message:
When debuging I noticed that this node have no values assigned
[img=http://img155.imageshack.us/img155/5362/debugio3.th.jpg]
this is my class were the debugger points me the problematic node
its header
and the main cpp
I now that my code is full o bad practices, and the root of the problem may be just c basics, but I dont know were's the best place to ask such question, I'm very noobish, and I'm trying to fix this error for a long time.
Thanks for any help =D
I have a problem assigning a node values, my code compiles without any errors or warnings, but renders nothing when runned, and displaying the message:
Code: Select all
"TUMLE:no node passed"
[img=http://img155.imageshack.us/img155/5362/debugio3.th.jpg]
this is my class were the debugger points me the problematic node
Code: Select all
classTruck.cpp
#include<irrlicht.h>
#include"classTruck.h"
#include <Newton.h>
#include "tumle.h"
using namespace tumle;
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
CTruck::CTruck()
{
truckNode=NULL;
ptruckNode=NULL;
}
CTruck::~CTruck()
{
delete truckNode;
delete ptruckNode;
}
void CTruck::set_Truck(IrrlichtDevice* device, stringc truckname,f32 x,f32 y,f32 z,IPhysicsManager *plevelMgr)
{
model=(truckname+".ms3d");
truckMgr = device->getSceneManager();
truckMesh = truckMgr->getMesh(model.c_str());
truckNode=truckMgr->addOctTreeSceneNode(truckMgr->getMesh(model.c_str()));
if (truckNode)
{
truckNode->setPosition(vector3df(x,y,z));
truckNode->setMaterialFlag(EMF_LIGHTING, false);
}
ptruckNode = plevelMgr->addPhysicsNode(truckNode, EBT_BOX, 10,vector3df(20,20,20));//problematic node
}
Code: Select all
classTruck.h
#ifndef _CLASSTRUCK_H
#define _CLASSTRUCK_H
#include <irrlicht.h>
#include <Newton.h>
#include "tumle.h"
using namespace tumle;
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
class CTruck
{
public:
CTruck();
virtual ~CTruck();
void set_Truck(IrrlichtDevice* device, stringc truckname,f32 x,f32 y,f32 z,IPhysicsManager *plevelMgr);
ISceneManager* truckMgr;
IAnimatedMesh* truckMesh;
ISceneNode* truckNode;
IPhysicsNode *ptruckNode;
private:
stringc model;
};
#endif
Code: Select all
rrr.cpp
#include <irrlicht.h>
#include "classTruck.h"
#include <Newton.h>
#include "tumle.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace tumle;
CTruck *objCTruck = new CTruck;
int main()
{
IrrlichtDevice* device = createDevice(EDT_DIRECT3D9, dimension2d<s32>(320, 240), 16, false, false, true);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* levelMgr = device->getSceneManager();
ISceneManager* truckMgr = device->getSceneManager();
device->getCursorControl()->setVisible(false);
IPhysicsManager *plevelMgr = createPhysicsManager(device);
objCTruck->set_Truck(device,"truck00",0,700,0,plevelMgr);
levelMgr->addSceneNode("truckMgr",0);
ICameraSceneNode* camera = levelMgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
camera->setPosition(vector3df(0,10,-100));
while(device->run())
{
driver->beginScene(true, true, SColor(255,200,200,200));
levelMgr->drawAll();
driver->endScene();
plevelMgr->update();
}
delete[] objCTruck;
device->drop();
return 0;
}
Thanks for any help =D
EDIT:
My first post was wrong, I didn't read over the whole thing correctly. This problem was covered before though, so you should have searched the forums.
IPhysicsManager::addPhysicsNode() cannot accept an OctTreeSceneNode. It only accepts an AnimatedMeshSceneNode or MeshSceneNode.
My first post was wrong, I didn't read over the whole thing correctly. This problem was covered before though, so you should have searched the forums.
IPhysicsManager::addPhysicsNode() cannot accept an OctTreeSceneNode. It only accepts an AnimatedMeshSceneNode or MeshSceneNode.
Code: Select all
ptruckNode = plevelMgr->addPhysicsNode(truckNode, EBT_BOX, 10,vector3df(20,20,20));//
[/code
TheQuestion = 2B || !2B
Thank you very much Halifax!
But even using addAnimatedMeshSceneNode the node still receives nothing
p.s.: this line in the main file must be commented
But even using addAnimatedMeshSceneNode the node still receives nothing
p.s.: this line in the main file must be commented
Code: Select all
ISceneManager* truckMgr = device->getSceneManager();
Okay, well then my other suggestions also come into play then too. I just wasn't sure at the time.
I don't think dynamic allocation works on global variables as an initialization value. So try one of the two at the bottom. (I'm not sure if the first one will work, but the second one should definitely work.)
or
And my third problem with your code is that you aren't deleting an array. So change your code for deleting the object to:
I don't think dynamic allocation works on global variables as an initialization value. So try one of the two at the bottom. (I'm not sure if the first one will work, but the second one should definitely work.)
Code: Select all
CTruck* objCTruck;
int main()
{
objCTruck = new CTruck;
Code: Select all
int main()
{
CTruck* objCTruck = new CTruck;
Code: Select all
delete objCTruck;
TheQuestion = 2B || !2B
you're right Halifax
fixed now.
still, the node dont want to receive arguments, but I think I'm getting more close to solve this. Is there some rule against declare abstract members in a class header? Like this node in the classTruck.h:
and then try to assign some value in the cpp of the header?
In the debugger I'd noticed that the non abstract members, declared in the header file, accept values and the abstract ones not.
I think that this post should be in other topic from now on.
ps: sorry for my noobish and my Englishhh.
fixed now.
still, the node dont want to receive arguments, but I think I'm getting more close to solve this. Is there some rule against declare abstract members in a class header? Like this node in the classTruck.h:
Code: Select all
ISceneNode* truckNode;
Code: Select all
truckNode=levelMgr->addAnimatedMeshSceneNode(levelMgr->getMesh(model.c_str()));
I think that this post should be in other topic from now on.
ps: sorry for my noobish and my Englishhh.
-
- Posts: 6
- Joined: Sat Feb 09, 2008 7:12 am
- Contact:
Long problem
I use Tumple 1.4 with corrections from the given forum
Problem in management(controlable) of monsters
The collision is necessary for monsters for me only
custom set position and rotation
As district in game hilly... The physics of Newton has not time to push out monsters
And they fail appear a card(map) of the world
It is necessary for me as it uses AI
sorry my bad English..
Problem in management(controlable) of monsters
The collision is necessary for monsters for me only
custom set position and rotation
As district in game hilly... The physics of Newton has not time to push out monsters
And they fail appear a card(map) of the world
It is necessary for me as it uses AI
sorry my bad English..
The user not speaking GOOD on EN
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
problem
I'm trying to use tumle for my game, but I get dimensions and body type do not match printed to stdout I add my objects like this
Code: Select all
IAnimatedMeshSceneNode* battlefield_stage = smgr->addAnimatedMeshSceneNode(smgr->getMesh("battlefield_stage.obj") );
if (battlefield_stage)
{
battlefield_stage->setScale(vector3df(3,3,3) );
battlefield_stage->setPosition(vector3df(10000,10000,0) );
battlefield_stage->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);
battlefield_stage->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
battlefield_stage->setMaterialFlag(EMF_LIGHTING, true);
battlefield_stage->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
battlefield_stage->setMaterialTexture( 0, driver->getTexture("battlefield_UV_map.png") );
battlefield_stage->getMaterial(0).EmissiveColor.set(0,100,100,100);
battlefield_stage->setVisible(false);
}
IPhysicsNode* stage_1_physics = pmgr->addPhysicsNode(battlefield_stage, EBT_LEVEL, 100, vector3df(5,5,5));
if (stage_1_physics)
{
stage_1_physics->setGravity(vector3df(0,0,0) );
}
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Posts: 1
- Joined: Wed Nov 19, 2008 11:45 am
Guys, I'm kind of having the same problem from buhatkj with this wrapper, which i am suspecting to be newton's fault after all.
When i try to retrieve the body mass, in order to set the gravity force using
NewtonBodyGetMassMatrix(body, &mass, &Ixx, &Iyy, &Izz);
the values are corrupted and do not reflect the values i originally defined:
I have defined 1000.0f for mass but the value being returned is different, and it seems that the mass value is actually being retrieved into another variable, probably due to some stack corruption.
Hey buhatkj, did you by any chance solve this stack problem you mentioned some time ago? If so can you please share this with us?
Im kind of stuck here so if anyone has any light to shed i would appreciate
Regards
When i try to retrieve the body mass, in order to set the gravity force using
NewtonBodyGetMassMatrix(body, &mass, &Ixx, &Iyy, &Izz);
the values are corrupted and do not reflect the values i originally defined:
I have defined 1000.0f for mass but the value being returned is different, and it seems that the mass value is actually being retrieved into another variable, probably due to some stack corruption.
Hey buhatkj, did you by any chance solve this stack problem you mentioned some time ago? If so can you please share this with us?
Im kind of stuck here so if anyone has any light to shed i would appreciate
Regards
Tumle & Irrlicht 1.5
I have some problem with CameraPhysicsNodeFPS when I using Irrlicht 1.5. I can not rotate camera by mouse. With Irrlicht 1.4.2. tumle works normally. Is that tumle problem or it is bug in my code?
Thanks
NOT A TUMLE PROBLEM!
It happens when I add to camera some nodes as children
Thanks
NOT A TUMLE PROBLEM!
It happens when I add to camera some nodes as children
Help
I'm having a small problem: I replaced my "addPhysicsLevelNode" with raymond's found in the 7th post on the 4th page of this thread, because I wanted to load a .3ds for my world. It worked perfectly for the time being. Now I am trying to add a physics cube to my program, and it compiles successfully. Yet when I run it, the program hangs and then closes. Does this have anything to do with the replaced code? It works perfectly if I just add a cube scene node, but as soon as I make a physics scene node it starts the hang-and-close routine. Here is the code in question:
Code: Select all
IAnimatedMesh* levelMesh = smgr->getMesh("./models/terrain.3ds");
ISceneNode* levelNode = smgr->addOctTreeSceneNode(levelMesh->getMesh(0), 0, -1, 128);
levelNode->setMaterialTexture(0, driver->getTexture("./textures/level1/base.jpg"));
levelNode->setMaterialFlag(EMF_LIGHTING, false);
levelNode->setPosition(vector3df(0, -35, 0));
IPhysicsNode* physlevel = pmgr->addPhysicsLevelNode(levelNode, levelMesh->getMesh(0));
ISceneNode* testCube = smgr->addCubeSceneNode();
testCube->setMaterialFlag(EMF_LIGHTING, false);
testCube->setPosition(vector3df(30, 0, 0));
testCube->setScale(vector3df(1, 1, 1));
IPhysicsNode* physTestCube = pmgr->addPhysicsNode(testCube, EBT_BOX, 10, vector3df(10, 10, 10)); //^^^^^^This is what cause the hang-and-close^^^^^^^^^^^^^^^^^^^^^^^^
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
ahhh
That's the problem I had too. I could add as many spheres and cubes as I wanted, but then when I added a level or other node it did the same.
With the level thing though, I noticed it said it resizes the newton world, when I tried to manually resize the newton world it did the same thing.
With the level thing though, I noticed it said it resizes the newton world, when I tried to manually resize the newton world it did the same thing.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar