Invert Camera Mouse Control
-
- Posts: 20
- Joined: Sun Nov 14, 2004 1:57 am
- Location: Rochester, New York, USA
Invert Camera Mouse Control
how would i go about inverting the mouse that controls a camera. it would be and usually is a great option for fps games!
thanx.. josh
thanx.. josh
I just succesfully implemented it in the source. I'll edit this post with the changes soon: then you can change them too and recompile the dll and lib file .
Changes:
in ISceneManager.h:
change
to
in CSceneManager.h
change
to
in CSceneManager.cpp:
change
to
in CCameraSceneNodeFPS.h
change
to
and add this in the private variables (you could add it under bool CursorKeys[4], because it's also a boolean variable)
in CCameraSceneNodeFPS.cpp:
Change the constructor to:
In the CCameraFPSSceneNode::animate() function, add this under the line mat.transformVect(Target);
Use:
addCameraSceneNodeFPS() function: the last variable is now a boolean variable called "invert", set this to true to invert the mouse (default is false).
I think those were the small things I changed. If it doesn't work properly (it could be I've forgotten posting a change) or you cannot compile the source, please post it here .
Changes:
in ISceneManager.h:
change
Code: Select all
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 100.0f, f32 moveSpeed = 500.0f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0) = 0;
Code: Select all
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 100.0f, f32 moveSpeed = 500.0f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool invert=false) = 0;
change
Code: Select all
//! Adds a camera scene node which is able to be controled with the mouse and keys
//! like in most first person shooters (FPS):
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 1500.0f, f32 moveSpeed = 200.0f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0);
Code: Select all
//! Adds a camera scene node which is able to be controled with the mouse and keys
//! like in most first person shooters (FPS):
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
f32 rotateSpeed = 1500.0f, f32 moveSpeed = 200.0f, s32 id=-1,
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool invert=false);
change
Code: Select all
//! Adds a camera scene node which is able to be controled with the mouse and keys
//! like in most first person shooters (FPS):
ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent,
f32 rotateSpeed, f32 moveSpeed, s32 id,
SKeyMap* keyMapArray, s32 keyMapSize)
{
if (!parent)
parent = this;
ICameraSceneNode* node = new CCameraFPSSceneNode(parent, this, CursorControl,
id, rotateSpeed, moveSpeed, keyMapArray, keyMapSize);
node->drop();
setActiveCamera(node);
return node;
}
Code: Select all
//! Adds a camera scene node which is able to be controled with the mouse and keys
//! like in most first person shooters (FPS):
ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent,
f32 rotateSpeed, f32 moveSpeed, s32 id,
SKeyMap* keyMapArray, s32 keyMapSize, bool invert)
{
if (!parent)
parent = this;
ICameraSceneNode* node = new CCameraFPSSceneNode(parent, this, CursorControl,
id, rotateSpeed, moveSpeed, keyMapArray, keyMapSize, invert);
node->drop();
setActiveCamera(node);
return node;
}
change
Code: Select all
//! constructor
CCameraFPSSceneNode(ISceneNode* parent, ISceneManager* mgr,
gui::ICursorControl* cursorControl, s32 id,
f32 rotateSpeed, f32 moveSpeed,
SKeyMap* keyMapArray, s32 keyMapSize);
Code: Select all
//! constructor
CCameraFPSSceneNode(ISceneNode* parent, ISceneManager* mgr,
gui::ICursorControl* cursorControl, s32 id,
f32 rotateSpeed, f32 moveSpeed,
SKeyMap* keyMapArray, s32 keyMapSize, bool invert);
Code: Select all
bool Invert;
Change the constructor to:
Code: Select all
//! constructor
CCameraFPSSceneNode::CCameraFPSSceneNode(ISceneNode* parent, ISceneManager* mgr,
gui::ICursorControl* cursorControl, s32 id, f32 rotateSpeed , f32 moveSpeed,
SKeyMap* keyMapArray, s32 keyMapSize, bool invert)
: CCameraSceneNode(parent, mgr, id), CursorControl(cursorControl),
MoveSpeed(moveSpeed), RotateSpeed(rotateSpeed), Invert(invert), firstUpdate(true)
Code: Select all
if (Invert)
Target.invert();
addCameraSceneNodeFPS() function: the last variable is now a boolean variable called "invert", set this to true to invert the mouse (default is false).
I think those were the small things I changed. If it doesn't work properly (it could be I've forgotten posting a change) or you cannot compile the source, please post it here .
Last edited by bal on Sun Nov 14, 2004 9:31 am, edited 3 times in total.
-
- Posts: 20
- Joined: Sun Nov 14, 2004 1:57 am
- Location: Rochester, New York, USA
i cant get the source to compile on my pc, so modifying it would be pretty pointless . if you could tell me how to fix the build problem that would be great.
i get 68 errors about unresolved external symbols .
you can see the log here:
http://www.dialogdesigns.com/BuildLog.htm
i am using windows xp pro w/ latest sp and using visual studio .NET 2005 Source Build ( just a little newer than 2005 beta, but is pretty much the same )
i get 68 errors about unresolved external symbols .
you can see the log here:
http://www.dialogdesigns.com/BuildLog.htm
i am using windows xp pro w/ latest sp and using visual studio .NET 2005 Source Build ( just a little newer than 2005 beta, but is pretty much the same )
-
- Posts: 20
- Joined: Sun Nov 14, 2004 1:57 am
- Location: Rochester, New York, USA
i should. i have it set in the global progrct settings under vc++ directories. my irllicht programs compile, just not the source. so maybe there is some library files besides the ones needed to make programs in order to buildsource? i hate link errors, there the only things that really p* me off when i program