XNA Creators Club Online
Page 1 of 1 (25 items)
Sort Posts: Previous Next

A Tale of 6 Cameras

Last post 08-08-2008 1:46 PM by CartBlanche. 24 replies.
  • 05-26-2007 9:14 PM

    A Tale of 6 Cameras

    Well I had a rush of blood last night and finally finished a sample that shows how to switch between a Fixed, Tracking, First Person and ThirdPerson Camera. It had been sitting on my HD for a few months now as I didn't know how to set up the 3D things correctly. Then suddenly last night some things became clear.



    The sample is based on the 3rd 3D Tutorial series and I originally thought it would make a good 4th Tutorial, but it seems the XNA team have something else planned for that.

    I hope I'm not speaking too soon by saying, I think I may be starting to understand this 3D mumbo jumbo :).

    Anyway here is the zip file that contains the C# projects/code as well as the Chrome ( Free Command Line compiler ) code and both executables incase you want to see if there are any differences between the 2 compilers.

    Instructions
    -------------
    Toggle Camera Modes = Tab or Left Shoulder Button
    Steer = Left & Right Arrow keys or Left Thumbstick
    Accelerate = Up Arrow key or Right Trigger
    Reset = A Button or Spacebar

    All feedback welcome on how this could be improved as I have a lot to learn.

    PS. as I don't have an Xbox, maybe someone could confirm that it works as advertised on there as well.


    There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.
    -= Paulo Coelho =-
  • 05-27-2007 12:13 AM In reply to

    Re: A Tale of 4 Cameras

    Very nice. Only one thing to improve it... add in the spring based case camera from the new sample http://creators.xna.com/Headlines/developmentaspx/archive/2007/01/01/Chase-Camera-Sample.aspx and you will have pretty much all the types of camera in one sample.


    The ZBuffer News and information for XNA

    Please read the forum FAQs - Bug reporting
  • 05-27-2007 4:25 AM In reply to

    Re: A Tale of 4 Cameras

    I'm not sure what kind of feedback you want. For the cameras or like.. "the next thing to do"?

    For the camera part I'd like to see multiple fixed cameras and have the application switch between the cameras depending on in which one the ship is actually visible in.

    Then it might be a good idea to put up obstacles and see if you'd need adjust the cameras depending on the obstacles (mostly a problem with 3rd person cameras).

    Also the third person camera isn't working as I thought it'd do cause it's basically looking into the ground.

    Very nice sample though :)
  • 05-27-2007 6:26 AM In reply to

    Re: A Tale of 4 Cameras

    Nice work there, mate!

    Little offtopic here, but this post clearly shows that community can create quality samples, so adding ability "upload your sample" would be awesome if you ask me!

    Cheers
  • 05-27-2007 1:30 PM In reply to

    Re: A Tale of 4 Cameras

    Hi all,
      Firstly thanks all for your comments. It's always good to know that someone has found the time to look at your stuff, even though it may not be the most eye opening or ground breaking stuff out there.

    @ZMan : Yes I plan to add the spring system to ThirdPerson demo when I have a bit more time. Thanks for mentioning the sample on your blog. Though I noticed a slight typo... "4 kids" should be "4 kinds".

    @Kawe : The sort of feedback I'm looking for is if there is anything in my code that could be improved, be written more effeciently or elegantly. Or if it works or does not work on an XBox. I'm mainly an Object Pascal developer with only about a year of C# commercial experience, so anything that would improve my C# coding skills would be usefull and would also enhance my prospects of getting a C# job ;-).

    Your suggestion of multiple fixed cameras sounds quite interesting and I may look into including it. Is there an easy way to check if an object is within a certain field of view? I suppose I could always work out the distance to each camera and switch to the one that is closest. Is there a better way of implementing this? I also like the camera collision idea, but think it may be too complex for this sample. I really wanted to keep it as simple as possible so that others like me, who are new to 3D, don't get too over whelmed with information.

    @XNAProgrammer : I agree, a central samples repository would be very usefull for all the new XNA developers out there. Maybe have a separate section for community content, so that it is separate from the offical content. If Microsoft could spare a resource to moderate the uploads, that would avoid duplicates and keep the quality of samples at a particular level.
    Would also look good on the CV to have had a sample accepted :).


    There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.
    -= Paulo Coelho =-
  • 05-27-2007 3:46 PM In reply to

    Re: A Tale of 4 Cameras

    Oh, right. I wasn't sure about what kind of feedback you wanted. But for the purpose of a sample I think what ZMan said is enough.

    My suggestions are just suggestions. I'm just like you, learning things. So I just made up things that I thought would be nice and that were missing. I honestly don't know how to do those things effciently.

    About switching between fixed cameras.. I think most games solve it by just putting up a big box that says "if you are here, use this camera.. otherwise use this one". Nothing too fancy.

    But yea, keep the sample simple and then make another one with what I suggested :) That'd be reall nice.
  • 05-27-2007 8:52 PM In reply to

    Re: A Tale of 4 Cameras

    Damn it! Someone beat me to it :)

    Nice work BTW.

    I've actually been working on releasing a similar demo for my site. My demo implements first person, spectator, flight sim, and orbit/third person camera types and I also support switching between the types. Mine differs in that I've used quaternions throughout.

    I'll post a link when it's done. Stay tuned!
  • 05-28-2007 6:47 AM In reply to

    Re: A Tale of 4 Cameras

    Hi Happy,
      Sounds like your demo is more advanced than mine. I have not even begun to get my head around quaternions. The only thing I know is that it's supposed to stop this evil guy called Gimbal Lock. So much to learn, so little time.
    There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.
    -= Paulo Coelho =-
  • 05-28-2007 6:51 AM In reply to

    Re: A Tale of 4 Cameras

    Kawe:

    Also the third person camera isn't working as I thought it'd do cause it's basically looking into the ground.


    I forgot to mention that if you change the ThirdPerson declaration to

    Vector3 cameraThirdPersonPosition = new Vector3( 0.0f, 1550.0f, 5000.0f );

    Then it has a better 3rd Person look.
    There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.
    -= Paulo Coelho =-
  • 05-31-2007 8:17 PM In reply to

    Re: A Tale of 4 Cameras

    I've released my quaternion camera game component. See here.
  • 06-11-2007 5:49 AM In reply to

    Re: A Tale of 4 Cameras

    I've not had the time to look at adding the spring system to the cameras, but I just added 2 top-down camera views to the sample, in light of the recent Tutorial 4 ( Make a game in 60 minutes ). The 2 cameras are Top Down Fixed and Top Down Centered. Hopefully the names are self explanitory.
    There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.
    -= Paulo Coelho =-
  • 06-19-2007 2:40 AM In reply to

    Re: A Tale of 4 Cameras

    Chrome code does indeed work on the Xbox 360. One of the guys from the UK XNA forum tested it out for me. The thread in question is...
    http://xna-uk.net/forums/t/285.aspx
    And a screen shot of it will be available soon.

    I actually think it may be possible to get it working on the XBox without the C# wrapper. That will be my next test.
    There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.
    -= Paulo Coelho =-
  • 06-22-2007 10:40 AM In reply to

    Re: A Tale of 4 Cameras