• Home
  • Products
    • Game Engine
      • Base
      • Mathematics
      • Geometry
      • Physics
      • Particles
      • Animation
      • Graphics
      • Game
      • Game UI
    • Windows Forms
      • Docking Windows
      • Text Editor Control
  • Downloads
  • Buy
    • Overview
    • Professional
    • Indie
    • Non-Commercial
  • Support
    • Overview
    • Blog
    • Forum
    • License FAQ
    • Documentation
  • About
    • About Us
      • Services
    • Contact Us
    • Press
    • Legal Terms
      • Imprint (English)
      • Imprint (German)
Select the search type
 
  • Site
  • Web
Search
DigitalRune.com
Login |Register
NEWS News RSS Feed BLOG Blog RSS Feed FORUM News RSS Feed DOCUMENTATION DigitalRune Software on YouTube DigitalRune Software on Twitter
You are here: SupportForum

If you want to contribute to the forum discussions, please Register or Login.

SearchHome
  • 1
  • 2
  • 3
  • 4
  • 5
HomeHomeDigitalRune Sof...DigitalRune Sof...Game EngineGame EngineBasic 3D Movement - Beginner HelpBasic 3D Movement - Beginner Help
Previous
 
Next
New Post
12/12/2010 2:44 AM
 
freakycode
No Ranking

Joined: 12/12/2010
Posts: 3
Basic 3D Movement - Beginner Help 
I have heard fantastic comments about the Physics library and Mathematics libraries and so I am currently using it in my current game project for XNA.

My problem is that I am used to using engines with a GUI such as Unity and I am not used to programming complete 3D camera movement and I'm not 100% certain on the best approaches. An example of this is that I'm trying to not use the Matrix44F.CreateLookAt instead favouring a more simple approach by multiplying the position matrix to the rotation matrix. Is this a good approach?

Currently I am writing a base camera class. I want it to be able to move freely but have no input logic although it will contain all the methods to control movement through 3D space.

I am storing the current position as a Vector3F and the rotation as a QuaternionF. I am able to get rotations and simple movement but I am new to this and so I am unsure of how to move in a local direction. Currently it is very easy to move around in the global space but I don't know how to feed a local direction such as Vector3F.Forward * speed to a method to move the camera in a local forward direction instead of simply globally moving along the Z Axis.

I am sorry if this is an extremely basic question but just thought I would ask the math magicians over here for any help to aid me in my pursuit for a nice Camera class. Any recommendations or points I should consider would also be nice. Don't worry I don't expect anyone to give me all the code just hints and bits of help.

Thank you :D
 
New Post
12/12/2010 3:17 PM
 
winterkewl
No Ranking

Joined: 12/8/2010
Posts: 32
Re: Basic 3D Movement - Beginner Help 
Hi Freakycode,

You probably will find a lot more useful information on the AppHub site then these forums as your question is much more about XNA / 3D graphics then the math/geo/physics libraries found here.

My suggestion would be for you to check out the Chase Camera sample on the App Hub (formerly known as Creator's Club) website first.

Chase Camera Sample

If you go through the Ship and ChaseCamera class you should be able to get a sense of how they did it.

As far as avoiding LookAtMatrices etc there are certainly ways you could do that, however, to me, it seems that the LookAt Method of creating a View Matrix is the easiest and most straight forward.

To create movement in the direction of "Forward" you must first define Forward.

In the case of a third person game forward would be defined (generally, not always) by a vector that starts at the Camera's Current Position and Ends at the Player's current position.

Vector3 forwardDirection = CameraCurrentPosition - PlayerCurrentPosition;

which you would generally want to Normalize and then use as a direction to apply the motion in the direction of.

Hope that helps!
 
New Post
12/13/2010 8:52 AM
Accepted Answer 
MartinG
7th Level Poster

www.digitalrune.com
Joined: 10/15/2006
Posts: 448
Re: Basic 3D Movement - Beginner Help 
Hi freakycode,

usually I would also point you to other tutorials (thanks winterkewl for providing the link!).

Except in this case DigitalRune Geometry offers a special type called Pose. You won't find it in XNA.
A Pose defines a position + orientation. We here use it almost everywhere to position objects in a world (rigid bodies, models, cameras, etc.). It was designed to handle the 90%-case. I have written a short two-part blog series that should give you an introduction and hopefully answers some of you question. (Part 2 explains how you can use Pose to control a camera.)  

Part 1: Pose = Position and Orientation
Part 2: How to use a Pose to define World and View matrix

I don't want to imply that this is the right way to do it - but it works great for us.
Let me know if it was helpful.
 
New Post
12/15/2010 1:39 PM
 
freakycode
No Ranking

Joined: 12/12/2010
Posts: 3
Re: Basic 3D Movement - Beginner Help 
Sorry it's taken so long to reply. I realized I wasn't getting emails alerting me to new posts.

Both helped but in my effort to fully utilize the benefits of the libraries I went for the use of Pose. I had got it working the more traditional way calculating the view matrix from a Vector3F translation and QuaternionF rotation but wow using Pose made things so much better. Cut my code down a hell of a lot.

Thank you for the articles the helped me a lot to understand how to use the class.
 
 Page 1 of 1
Previous
 
Next
HomeHomeDigitalRune Sof...DigitalRune Sof...Game EngineGame EngineBasic 3D Movement - Beginner HelpBasic 3D Movement - Beginner Help


DigitalRune is a trademark of Garstenauer Information Technology OG.

Garstenauer Information Technology OG
Weingartenstrasse 35, 4452 Ternberg
Austria (EUROPE)
office@digitalrune.com

Home Products Downloads Buy Support About Us
Game Engine Particles Windows Forms Professional Blog Services
Base Animation Docking Windows Indie Forum Contact Us
Mathematics Graphics Text Editor Control Non-Commercial License FAQ Press (News)
Geometry Game Documentation Legal Terms
Physics Game UI Imprint
Impressum
Copyright © 2006-2012 Garstenauer Information Technology OG Terms Of UsePrivacy Statement