• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
lucky6969b

Anyone guess what exactly all these mean?

10 posts in this topic

I've got the book AI Programming Wisdom 3, in the CD-ROM, I've got Bourne and Sattar source code on Autonomous Camera Control, when I see these 2 lines and having not any comments, I am not sure if mvFacing actually means look at vector or look at target, and not sure what mvView and mvCross means? Does anyone here have the same book with me know what these are all about? Thanks Jack

// Autonomous camera class.
class Camera
{
public:
	Vector3		mvPosition, mvView, mvUp;
	Vector3		mvFacing, mvCross;

Update:

I dug a little bit deeper, but found out that mvFacing is actually the lookat vector, but mvCross and mvView has no idea what that is.

Thanks

Jack

0

Share this post


Link to post
Share on other sites

mvCross is most likely the right or left vector of the camera that represents its x-axis. mvCross is obtained by a cross-product between the camera's direction vector and the up vector; that's why it's called mvCross. By moving along this vector you can create the so called strafe effect of a camera.

 

To create the lookAt matrix (most cameras calculate this matrix) you need a direction vector and a target vector. The direction vector is the vector that's pointing in the direction your camera is facing and this one is usually obtained from subtracting the position vector from the target vector. Based on the way the variables are set up I assume the first 3 vectors are the user-supplied vectors thus mvView is most likely the target vector (e.g. the coordinate a camera is looking at like (0,0,0)) while the mvFacing and mvCross are then later calculated thus mvFacing is then probably the camera's direction vector.

1

Share this post


Link to post
Share on other sites

I found this old interactive tutorial (written in Java, you will proably have to lower your security settings from Control Panel -> Java -> Security tab in order to execute it) to be very useful in understanding how cross products work and how two vectors form a plane (the cross product is always perpendicular to that plane).

 

You can click on the plane to move it around, or you can click on the arrows A and B to see how the cross product is affected.

0

Share this post


Link to post
Share on other sites


Can you post the code where those vectors are initialized?
This is really the only way to know for sure - the names could be misleading, so unless you check the code that is using these objects then you are really only guessing!
0

Share this post


Link to post
Share on other sites

I don't know if the original authors are willing to let me disclose the source code...
But here is the constructor method

 

//
//    Camera::Camera()
//
//    Default constructor.
//
Camera::Camera()
{
    mnCurrentProfile = 0;
    mnNumOfProfiles = 0;

    mvPosition = Vector3::origin;
    mvView = Vector3::origin;
    mvUp = Vector3::yAxis;
    mvFacing = Vector3::origin;
    mvCross = Vector3::origin;
    
    mfSecondsUntilEnd = 1.0f;

    mnRayCastingMethod = kCameraCurrent;
    mnSafePointMethod = kSafePoint_targetrelative;

    mfFrameTime = 0.0f;

}


//
//    Camera::~Camera()
//
//    Default destructor.
//
Camera::~Camera()
{
}
0

Share this post


Link to post
Share on other sites

Hello friends,
I've tried to connect the camera from the book to an Ogre camera, this's what I got so far

Ogre::Vector3 BourneVec3ToOgreVec3(Dolly_Cam::Vector3 vec) {
    Ogre::Vector3 vec3;
    vec3.x = vec.x;
    vec3.y = vec.y;
    vec3.z = vec.z;
    return vec3;
}

Dolly_Cam::Vector3 OgreVec3ToBourneVec3(Ogre::Vector3 vec) {
    Dolly_Cam::Vector3 vec3;
    vec3.x = vec.x;
    vec3.y = vec.y;
    vec3.z = vec.z;
    return vec3;
}
cam.mvPosition = OgreVec3ToBourneVec3(mSceneMgr->getSceneNode("Worker00001Node")->getPosition() + Ogre::Vector3(0, 5, 5));
cam.mvFacing = cam.mvPosition - OgreVec3ToBourneVec3(mSceneMgr->getSceneNode("Worker00001Node")->getPosition());
changeDollyCam(cam);
void OgreRecastApplication::changeDollyCam(const Dolly_Cam::Camera& cam) {  
  
        Ogre::Camera* camera = mSceneMgr->createCamera("Dolly_Cam");
        mWindow->removeViewport(0);
        camera->setPosition(BourneVec3ToOgreVec3(cam.mvPosition));
        camera->lookAt(BourneVec3ToOgreVec3(cam.mvView));
        Ogre::Radian R = Ogre::Math::ATan(Ogre::Math::Tan(Ogre::Degree((float)45/2))/mCamera->getAspectRatio())*2;
        camera->setFOVy(R);
    

        mViewport = mWindow->addViewport( camera );
        mViewport->setCamera(camera);

        delete mCameraMan;
        mCameraMan = new OgreBites::SdkCameraMan(camera);
    

}
 

But it looks perhaps at the opposite direction. But I have tried to reverse the order of subtraction to no avail.
To my understanding of vectors, the look at vector should be camera's position substracting the position of look at target.
Correct me if I am any wrong.

Update:

Notice I've got a typo for mCamera => camera in addViewport line, but the result is same
Thanks
Jack

Edited by lucky6969b
0

Share this post


Link to post
Share on other sites

To my understanding of vectors, the look at vector should be camera's position substracting the position of look at target.


That's incorrect. The look at vector should (position of look at target) - (camera's position).
 
The vector AB = B - A.
 
So:
cam.mvFacing = OgreVec3ToBourneVec3(mSceneMgr->getSceneNode("Worker00001Node")->getPosition()) - cam.mvPosition;

But it looks perhaps at the opposite direction. But I have tried to reverse the order of subtraction to no avail.

 
What exactly happens when you reverse the order of subtraction?
 
Does Ogre and Dolly use the same coordinate systems? Maybe you are mixing Left hand and Right Hand coordinates... Edited by TiagoCosta
1

Share this post


Link to post
Share on other sites

Wait a second. I just pop some figures out

Character Pos: x=-20.0 y=0.0 z=-50.0

Dolly Cam Pos: x=-20.0 y=5.0 z=-45.0

look at vector: x=0.0 y= -0.707 z= -0.707

Anything wrong with these figures?

 

 

 

It seems the look at vector is mirrored in the y axis, from looking down toward negative z to looking down toward positive z

 

 

https://www.youtube.com/watch?v=ioMH9Gmkick&feature=youtu.be

 

Thanks

Jack

Edited by lucky6969b
0

Share this post


Link to post
Share on other sites

From the Camera::Update methods (I mean those from the CD-ROM) it can be seen that

a) mvView is set to a world position which is targeted by the camera (mvTargetPosition, vGoadViewpoint, or similar), and

b) mvFacing is set to the direction to that target (normalized difference from mvPosition to mvView).

Later on in Camera::Look() one can see that mvVew is directly used as center argument for gluLookAt, which again means a target position (see e.g. manual page for gluLookAt).

 

The difference between 2 positions is calculated by subtracting the start position from the end position; TiagoCosta has mentioned it. However, the view direction of an unrotated camera is convention. It may look along any positive or negative axis! Since you adapt the source code for Ogre, you have to pick the convention as is used by Ogre, and compare that with the convention used in the article's source code; perhaps you have to adapt this part, too.

Edited by haegarr
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0