jchmack
01-05-2007 12:39:01
Ever since i upgraded to 0.6 my characters move faster at slower framerates and vice versa. At first i thought it must be me but i still can't find a solution. It worked fine before the upgrade but now... I believe that before i was using 0.3 i skipped 0.4 and just upgrade to eihort/0.6/VSSP1 all at once.
Does anyone else have similar problems?
how i make my character
functions i use to move him
from where i call
basically i create him. When a key is pressed i change his movestate. Every frame i call movecharacter() which calls mCharacter->move() in the appropriate direction depending on the movestate. Its all pretty basic stuff.
on a side note if your wondring why i use the whole movestate thing its for networking purposes. So i can just send a movestate along with a position.
sorry if the code is excessive but ive been looking over this for a while. Its basically derived from tutorial 606. I don't know why it would do this..
Im betting that i need to scale the movement by the time SOMEWHERE.
Im starting to think it might be an NXOgre issue but i have to admit i haven't really looked at the NXOgre source yet. Figured id ask here first. Thanks to all who help in advance
edit: by the way im running it in:
release mode
NXOgre 0.6
PhysX 2.7.0
Eihort
links for my research purposes:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=3932
http://www.ogre3d.org/phpBB2addons/view ... d673edd8fc
Does anyone else have similar problems?
how i make my character
void GameCharacter::Create(scene *mScene,Vector3 InitialPosition)
{
name+=Ogre::StringConverter::toString(objectcount);
objectcount++;
blueprint<character> bp;
bp.setToDefault();
bp.setGravity(false);
bp.setSlopeLimit(45);
bp.setStep(0.3);
bp.setShapeAsCapsule(CharacterRadius,CharacterHeight);
bp.setMesh("");
mCharacter = bp.create(name,InitialPosition,mScene);
//mPlayer->mController->
//mBody->setGroup(mScene->findGroup("Projectiles"));
PivotNode= mCharacter->mNode->createChildSceneNode(name+"Pivot Node");
MeshNode = mCharacter->mNode->createChildSceneNode(name+" Mesh Node");
MeshEntity = mScene->mSceneMgr->createEntity(name+" Entity",mesh);
MeshNode->translate(Vector3(0,-((CharacterHeight/2)+CharacterRadius),0));
MeshNode->scale( Vector3(1,1,1)*NinjaMeshConverter*(CharacterHeight+2*(CharacterRadius)));
MeshNode->attachObject(MeshEntity);
CharacterCamera = mScene->mSceneMgr->createCamera(name+" Camera");
CharacterCamera->setNearClipDistance(0.1);
//CharacterCamera->setAspectRatio(Real(mViewport->getActualWidth()) / Real(mViewport->getActualHeight()));
//CharacterCamera->moveRelative(Vector3(0,.1,-CharacterRadius));
CharacterCamera->moveRelative(Vector3(0,10,10));
CharacterCamera->pitch(Degree(-30));
//CharacterCamera->setAutoTracking(true,mPlayer->mNode);
mCharacter->mNode->attachObject(CharacterCamera);
GunNode = PivotNode->createChildSceneNode(name+" Gun Node");
GunNode->translate(Vector3(0,0,-(CharacterRadius+0.01)));
Entity* GunNodeEntity = mScene->mSceneMgr->createEntity(name+"GunNode CrossHairs", "nx.crosshair.mesh");
GunNode->attachObject(GunNodeEntity);
GunNode->scale(5,5,5);
}
functions i use to move him
void GameCharacter::ChangeMovestate(MoveState _mMoveState)
{
mMoveState=_mMoveState;
}
void GameCharacterManager::MoveCharacter(list<GameCharacter*>::iterator Character)
{
//mNetworkMgr->
switch((*Character)->mMoveState)
{
case BackwardLeft:
(*Character)->mCharacter->move(character::BACKWARD);
(*Character)->mCharacter->move(character::SIDESTEP_LEFT);
break;
case Backward:
(*Character)->mCharacter->move(character::BACKWARD);
break;
case BackwardRight:
(*Character)->mCharacter->move(character::BACKWARD);
(*Character)->mCharacter->move(character::SIDESTEP_RIGHT);
break;
case Left:
(*Character)->mCharacter->move(character::SIDESTEP_LEFT);
break;
case Neutral:
break;
case Right:
(*Character)->mCharacter->move(character::SIDESTEP_RIGHT);
break;
case ForwardLeft:
(*Character)->mCharacter->move(character::FORWARD);
(*Character)->mCharacter->move(character::SIDESTEP_LEFT);
break;
case Forward:
(*Character)->mCharacter->move(character::FORWARD);
break;
case ForwardRight:
(*Character)->mCharacter->move(character::FORWARD);
(*Character)->mCharacter->move(character::SIDESTEP_RIGHT);
break;
default:
break;
}
}
from where i call
MoveState temp;
short int x=0,z=0;
if (isKeyDown(Z))
++z;
if (isKeyDown(NEG_Z))
--z;
if (isKeyDown(X))
++x;
if (isKeyDown(NEG_X))
--x;
if(z>0) //forward
{
if(x>0)
temp=ForwardLeft;
else if (x<0)
temp=ForwardRight;
else
temp=Forward;
}
else if (z<0) //backward
{
if(x>0)
temp=BackwardLeft;
else if (x<0)
temp=BackwardRight;
else
temp=Backward;
}
else //neutral
{
if(x>0)
temp=Left;
else if (x<0)
temp=Right;
else
temp=Neutral;
}
if(character1->mMoveState!=temp)
{
character1->ChangeMovestate(temp);
if(mNetworkMgr.connected==true)
mNetworkMgr.SendCharacterMove(character1);
}
basically i create him. When a key is pressed i change his movestate. Every frame i call movecharacter() which calls mCharacter->move() in the appropriate direction depending on the movestate. Its all pretty basic stuff.
on a side note if your wondring why i use the whole movestate thing its for networking purposes. So i can just send a movestate along with a position.
sorry if the code is excessive but ive been looking over this for a while. Its basically derived from tutorial 606. I don't know why it would do this..
Im betting that i need to scale the movement by the time SOMEWHERE.
Im starting to think it might be an NXOgre issue but i have to admit i haven't really looked at the NXOgre source yet. Figured id ask here first. Thanks to all who help in advance
edit: by the way im running it in:
release mode
NXOgre 0.6
PhysX 2.7.0
Eihort
links for my research purposes:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=3932
http://www.ogre3d.org/phpBB2addons/view ... d673edd8fc