Howto: Flying 3rd Person camera

A forum to store posts deemed exceptionally wise and useful
Agasa

help me!

Post by Agasa »

help me! i tried to implement the camera in the "movement" tutorial, but it gives me a lot of errors:

Code: Select all

--------------------Configuration: Movement - Win32 Debug--------------------
Compiling...
main.cpp
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(34) : error C2061: syntax error : identifier 'f32'
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(57) : error C2653: 'core' : is not a class or namespace name
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(57) : error C2065: 'dimension2d' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(57) : error C2065: 'f32' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(57) : warning C4804: '>' : unsafe use of type 'bool' in operation
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(57) : error C2664: 'setSize' : cannot convert parameter 1 from 'bool' to 'const class irr::core::dimension2d<float> &'
        Reason: cannot convert from 'bool' to 'const class irr::core::dimension2d<float>'
        No constructor could take the source type, or constructor overload resolution was ambiguous
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(58) : error C2653: 'core' : is not a class or namespace name
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(58) : warning C4804: '>' : unsafe use of type 'bool' in operation
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(58) : error C2664: 'setSize' : cannot convert parameter 1 from 'bool' to 'const class irr::core::dimension2d<float> &'
        Reason: cannot convert from 'bool' to 'const class irr::core::dimension2d<float>'
        No constructor could take the source type, or constructor overload resolution was ambiguous
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(85) : error C2146: syntax error : missing ')' before identifier 'fDT'
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(85) : error C2182: 'Update' : illegal use of type 'void'
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(85) : error C2433: 'Update' : 'inline' not permitted on data declarations
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(85) : error C2350: 'cFollowingCamera::Update' is not a static member
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(85) : error C2059: syntax error : ')'
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(85) : error C2143: syntax error : missing ';' before '{'
c:\program files\microsoft visual studio\vc98\include\ifollowingcamera.h(85) : error C2447: missing function header (old-style formal list?)
D:\guide\conan\irrlicht-0.9\irrlicht-0.9\examples\04.Movement\main.cpp(155) : error C2065: 'pSMGR' : undeclared identifier
D:\guide\conan\irrlicht-0.9\irrlicht-0.9\examples\04.Movement\main.cpp(172) : error C2039: 'Update' : is not a member of 'ISceneNode'
        c:\program files\microsoft visual studio\vc98\include\iscenenode.h(30) : see declaration of 'ISceneNode'
D:\guide\conan\irrlicht-0.9\irrlicht-0.9\examples\04.Movement\main.cpp(172) : error C2065: 'fDeltaTime' : undeclared identifier
Error executing cl.exe.

Movement.exe - 17 error(s), 2 warning(s)
help me please!
Alighieri
Posts: 1
Joined: Wed Mar 17, 2004 6:27 am

Post by Alighieri »

For some reason, I believe that I am invoking this wrong...

Code: Select all

    cFollowingCamera::cFollowingCamera(pPlayerNode, smgr, vector3df(0, 10, -30));
I am using the second version of this code, and the program compiles, but crashes.
the_viking
Posts: 23
Joined: Fri Aug 06, 2004 12:28 pm

Post by the_viking »

The rotation of the camera is controlled by the attached Billboard Nodes (see the constructor of the camera class).
The relative position of the camera to the object is, if you look a bit closer, the third parameter of the constructor ("vRelativePos"). The interpolation speed can be controlled by the last parameter, "speed".
If you want to control the position and rotation manually, you'll have to overwrite some sections in the Update() method. Just don't ask the attached billboard node for the position and rotation, but replace them with another member variable, like "m_TargetPosition" and "m_TargetRotation". Implement some setter for these two (like: UpdateTarget(position, rotation)) and you're ready to direct the camera wherever you want it to be.

Sorry for maybe pushing this post up ;) But I was searching for some code of mine I once posted here and I just saw this older post from me, noticing some people are still interested and having some problems. So please don't hurt me or anything ;)
Glenn
Posts: 4
Joined: Tue Jul 25, 2006 11:48 pm

:(

Post by Glenn »

im trying this but i always get this error:

Code: Select all

no matching function for call to `cFollowingCamera::cFollowingCamera(irr::scene::ISceneNode*&, irr::scene::ISceneManager*&, irr::core::vector3df, irr::f32)'  candidates are: cFollowingCamera::cFollowingCamera(const cFollowingCamera&)  note             cFollowingCamera::cFollowingCamera(irr::scene::ISceneNode*, irr::scene::ISceneManager*, irr::core::vector3df&, irr::f32)  
i just built the code this way:

Code: Select all

cFollowingCamera* mpCam;
mpCam = new cFollowingCamera(hero,smgr,vector3df(10,-30,10),(f32)5); 
can any1 help me?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Try to change the constructor to use const vector3df&, otherwise pass the constructor a variable instead of a temporary object.
Glenn
Posts: 4
Joined: Tue Jul 25, 2006 11:48 pm

:(

Post by Glenn »

hybrid wrote:Try to change the constructor to use const vector3df&, otherwise pass the constructor a variable instead of a temporary object.
thanks,that seems to work, it compiles but now when i run the program it crashes. is
this code buggy or its me?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, could be both. But debugging might help :wink:
Post Reply