Page 13 of 29

Posted: Fri May 25, 2007 7:26 pm
by Dances
When I try to compile it I get the error

Code: Select all

  ../../../irrlicht-1.3/lib/Win32-gcc/libIrrlicht.a 
 D:\game!\irrNewt-0.3\source\Makefile.win [Build Error]  [IrrNewt.dll] Error 1 
I deleted my make and all my os and that didn't help...

Using Dev-C++

Posted: Sat May 26, 2007 11:25 am
by white tiger
are you sure your libIrrlicht.a is here, respect to irrnewt project position?

../../../irrlicht-1.3/lib/Win32-gcc/libIrrlicht.a ?

this is the position of it in my computer, if you have it in different position,
you should go in

project->project options->parameters and in linker change it

however too many people have problem with, so i'll upload a 1.3 version

Posted: Sat May 26, 2007 3:56 pm
by Dances
You are awesome. I thought it was the same but I checked it since you suggested it and there was an extra ../ in there... thanks.

Posted: Tue May 29, 2007 7:46 pm
by Dances
For some reason I cannot get my character controller to collide with another node; it just falls through. I've also noticed every time this code is executed TWICE the other node isn't visible... but that probably doesn't have to do with irrNewt.... so....

Code: Select all

     p1node = gameManager->getSceneManager()->
        addOctTreeSceneNode(planemesh);
     if(p1node)
     {
	   p1node->setMaterialFlag(EMF_LIGHTING, false);
	   p1node->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
	   p1node->setMaterialTexture(0, gameManager->getDriver()->getTexture("media/logo.png"));
     }
     
     floornode = gameManager->getSceneManager()->
        addOctTreeSceneNode(planemesh);
     if (floornode)
     {
	   floornode->setMaterialFlag(EMF_LIGHTING, false);
	   floornode->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
	   floornode->setMaterialTexture(0, gameManager->getDriver()->getTexture("media/logo.png"));
	   floornode->setScale(vector3df(1,15,1));
	   floornode->setPosition(vector3df(200, -10, 0));
	   floornode->setRotation(vector3df(0, 0, 90));
     }
     
     SBodyFromNode mapdata;
     mapdata.Node=floornode;
     mapdata.Mesh=planemesh;
     floorbody=gameManager->getPhysicsEngine()->createBody(mapdata);
     
     SBodyFromNode p1data;
     p1data.Type = EBT_PRIMITIVE_CAPSULE;
     p1data.Node=p1node;
     p1data.Mesh=planemesh;
     p1body=gameManager->getPhysicsEngine()->createCharacterController(
        gameManager->getPhysicsEngine()->createBody(p1data));
     p1body->setRotationUpdate(false);
	 p1body->setContinuousCollisionMode(true);
	 gameManager->getPhysicsEngine()->getUtils()->avoidRotationOnAllAxis(p1body);
	 
	 IMaterial* p1material;
     IMaterial* floormaterial;

	 p1material=gameManager->getPhysicsEngine()->createMaterial();
	 floormaterial=gameManager->getPhysicsEngine()->createMaterial();

	 p1body->setMaterial(p1material);
	 floorbody->setMaterial(floormaterial);

	 p1material->setElasticity(floormaterial,0.0f);
	 p1material->setFriction(floormaterial,0.0f,0.0f);
	 p1material->setSoftness(floormaterial,0.0f);
	 p1body->addForceContinuous(vector3df(0, -30.0f, 0));
     
     camera = gameManager->getSceneManager()->addCameraSceneNode(0, 
        vector3df(60,40,-100), vector3df(60,40,0));
EDIT: The floor disappearing does have to do with IrrNewt and/or Newton... as when I remove the update call it doesn't disappear anymore...

Posted: Wed May 30, 2007 11:03 am
by white tiger
I've also noticed every time this code is executed TWICE the other node isn't visible...
but why you execute twice the code? this create 2 bodies and not only 1, the 2 bodies are linked to the same node and this can cause strange behaviour

also, insert

gameManager->getPhysicsEngine()->drawAllDebugInfos()

after smgr->drawAll() and before driver->endScene() and seee what happen and why it falls trought the wall. however you can't create 2 bodies wich is linked to the same node and in irrnewt character controller example the character doesn't fall trought the wall

another question: how you update irrnewt? do you put the update() call at the begin of the main loop?

Posted: Fri Jun 01, 2007 10:21 am
by Dances
white tiger wrote:
but why you execute twice the code? this create 2 bodies and not only 1, the 2 bodies are linked to the same node and this can cause strange behaviour
I run it twice when the game throws back to the main menu and then is restarted. I never thought about having two bodies. I altered my code to use a new physics device each time, and now the floor disappearing issue has been solved. Thanks for pointing this out XD.
white tiger wrote: also, insert

gameManager->getPhysicsEngine()->drawAllDebugInfos()

after smgr->drawAll() and before driver->endScene() and seee what happen and why it falls trought the wall. however you can't create 2 bodies wich is linked to the same node and in irrnewt character controller example the character doesn't fall trought the wall
The floor's debug info is clearly not scaled or rotated to match the floor node. What can I do to make it match up? Setting the scale of floorbody just crashes my app...
white tiger wrote: another question: how you update irrnewt? do you put the update() call at the begin of the main loop?
yes

Posted: Fri Jun 01, 2007 1:19 pm
by white tiger
I run it twice when the game throws back to the main menu and then is restarted.
in my FPS i have the restart function. i destroy the old world, create a new one and all works ok so the bug would be in your code.

you should post the code wich destroy the old world and create a new one when restarting, i'll check it
The floor's debug info is clearly not scaled or rotated to match the floor node. What can I do to make it match up? Setting the scale of floorbody just crashes my app...
but does it happen only when the game restart (2nd time the code is executed) or also when the game start normally (1st time it is executed) ?

Posted: Fri Jun 01, 2007 2:33 pm
by Dances
in my FPS i have the restart function. i destroy the old world, create a new one and all works ok so the bug would be in your code.

you should post the code wich destroy the old world and create a new one when restarting, i'll check it
As I said the disappearing node is gone now so I think the bug isn't here.
but does it happen only when the game restart (2nd time the code is executed) or also when the game start normally (1st time it is executed) ?
It has this problem both the first and all other times now.

My cpp file currently looks like this

Code: Select all

#include "irrlicht.h"
#include "gspgame.h"
#include "gmanager.h"
#include <irrnewt.hpp>

using namespace core;
using namespace irr;
using namespace newton;

spgame::spgame(manager* passedManager)
{
   gameManager = passedManager;
   gameManager->resetKeys();
   planemesh = 0;
   p1node = 0;
   floornode = 0;
   camera = 0;
   p1body = 0;
   
   pworld = createPhysicsWorld(gameManager->getDevice());
   pworld->setFrictionModel(EOM_FAST);
   
   planemesh = gameManager->getSceneManager()->getMesh("media/models/plane.3ds")->getMesh(0);
   
   p1node = gameManager->getSceneManager()->
        addOctTreeSceneNode(planemesh);
     if(p1node)
     {
	   p1node->setMaterialFlag(EMF_LIGHTING, false);
	   p1node->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
	   p1node->setMaterialTexture(0, gameManager->getDriver()->getTexture("media/logo.png"));
     }
     
     floornode = gameManager->getSceneManager()->
        addOctTreeSceneNode(planemesh);
     if (floornode)
     {
	   floornode->setMaterialFlag(EMF_LIGHTING, false);
	   floornode->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
	   floornode->setMaterialTexture(0, gameManager->getDriver()->getTexture("media/logo.png"));
	   floornode->setScale(vector3df(1,15,1));
	   floornode->setPosition(vector3df(200, -10, 0));
	   floornode->setRotation(vector3df(0, 0, 90));
     }
     
     SBodyFromNode mapdata;
     mapdata.Node=floornode;
     mapdata.Mesh=planemesh;
     floorbody=pworld->createBody(mapdata);
     
     SBodyFromNode p1data;
     p1data.Type = EBT_PRIMITIVE_CAPSULE;
     p1data.Node=p1node;
     p1data.Mesh=planemesh;
     p1body=pworld->createCharacterController(pworld->createBody(p1data));
     p1body->setRotationUpdate(false);
	 p1body->setContinuousCollisionMode(true);
	 pworld->getUtils()->avoidRotationOnAllAxis(p1body);
	 IMaterial* p1material;
     IMaterial* floormaterial;

	 p1material=pworld->createMaterial();
	 floormaterial=pworld->createMaterial();

	 p1body->setMaterial(p1material);
	 floorbody->setMaterial(floormaterial);

	 p1material->setElasticity(floormaterial,0.0f);
	 p1material->setFriction(floormaterial,5.0f,5.0f);
	 p1material->setSoftness(floormaterial,0.0f);
	 //p1body->addForceContinuous(0,-30.0f,0);
     
     camera = gameManager->getSceneManager()->addCameraSceneNode(0, 
        vector3df(60,40,-100), vector3df(60,40,0));
}

void spgame::handleKeys()
{
     if(gameManager->getEscapeKey())
     {
        gameManager->stopMusic();
        gameManager->resetPause();
        gameManager->setGameState(1);
     }
     if(gameManager->getPKey())
        gameManager->togglePause();
     if(gameManager->getRightKey())
     {
        p1body->setVelocity(vector3df(2.0f,0,0));
     }
     if(gameManager->getLeftKey())
     {
        p1body->setVelocity(vector3df(-2.0f,0,0));
     }
     if(gameManager->getDecimalKey())
        p1body->jump(10);
     if(gameManager->getDownKey())
     {
        if(p1body->crouch(0.5))
           pworld->getUtils()->avoidRotationOnAllAxis(p1body);
     }
     else 
        if(p1body->stand(6))
           pworld->getUtils()->avoidRotationOnAllAxis(p1body);
}

void spgame::updatePhysics()
{
     pworld->update();
     if(p1node->getPosition().X > camera->getPosition().X + 20)
     {
        camera->setPosition(vector3df(camera->getPosition().X+1,camera->getPosition().Y,camera->getPosition().Z));
        camera->setTarget(vector3df(camera->getPosition().X,camera->getPosition().Y,0));
     }
     else if(p1node->getPosition().X < camera->getPosition().X - 75)
     {
        p1node->setPosition(vector3df(camera->getPosition().X-75,p1node->getPosition().Y,p1node->getPosition().Z));
        p1body->setPosition(vector3df(camera->getPosition().X-75,p1node->getPosition().Y,p1node->getPosition().Z));
     }
}

void spgame::drawDebugInfo()
{
     pworld->drawAllDebugInfos();
}

spgame::~spgame()
{
    pworld->destroyWorld();
}
I removed the "gravity" to test my movement code; so you can ignore that.

Posted: Sat Jun 02, 2007 10:04 am
by white tiger
The floor's debug info is clearly not scaled or rotated to match the floor node. What can I do to make it match up? Setting the scale of floorbody just crashes my app...
post a screen for this (including irrnewt debug info) and upload your plane.3ds file somewhere

Posted: Sat Jun 02, 2007 7:37 pm
by Dances

Posted: Sat Jun 02, 2007 9:09 pm
by benny53
I think the download site is down...

Posted: Sat Jun 02, 2007 9:36 pm
by Dances
benny53 wrote:I think the download site is down...
IrrNewt's site isn't working for me right now either... could be just down for maintenance or something, though.

Posted: Sat Jun 02, 2007 10:04 pm
by white tiger
it's the server, it's free and have banwidth limit

i will re upload the eiter site back to sourceforge and not upload it to another server without test it accurately

Posted: Sun Jun 03, 2007 5:54 am
by kburkhart84
@White Tiger.

You probably already know this, but your little library thingy(IrrNewt) has been ported by SIO2 to be used in IrrSpintz. Don't think it is any problem but just in case. Not trying to cause trouble though. I think it's a good thing...

Posted: Sun Jun 03, 2007 11:44 am
by white tiger
@Dances

from your code:

Code: Select all

floornode->setScale(vector3df(1,15,1)); 
do a test. try to scale uniformly the floor node (for example 3,3,3 15,15,15 exc.. ). is the problem fixed?