Camera Rotation and Camera Follow
  Home FAQ Contact Sign in
microsoft.public.win32.programmer.directx.graphics only
 
Advanced search
POPULAR GROUPS

more...

 Up
Camera Rotation and Camera Follow         

Group: microsoft.public.win32.programmer.directx.graphics · Group Profile
Author: Mike
Date: Nov 11, 2007 16:33

I hope this is the right place, i'am new to this so bear with me :)

From what i gathered one of the directx camera's is a spherical camera which
allows you to rotate around an object such as a loaded mesh and has zoom
function aswell. Now this has all been implemened by someone else.
(yes bad idea to fiddle with someone elses code rather then do it myself i
know :) )

However i though i'd try some experimentation, and i was hoping to change it
to a camera which can follow an object as it moves around the 3d space.

So far i can get the camera to track easily enough by setting the LookAtPt
to the position of the mesh by calling the SetViewParamters method of the
camera, however i also have to set EyePt aswell.
Something akin to below

Game.camera.SetViewParameters(new Vector3(Game.camera.EyeLocation.X,
Game.camera.EyeLocation.Y , Game.camera.EyeLocation.Z , new
Vector3(Hero.Position.X, Hero.Position.Y, Hero.Position.Z));

This gets called every render, however where before without setting view
parameters as above the 3D spherical rotation aspect worked quite well and
smooth.

When i update the parameters as above i can no longer rotate as
'effectively', it isn't accurate and jerks around, i'd have thought that by
by right clicking and moving the mouse the EyeLocation.? would get updated
and it wouldn't be a problem, but i'd geuss i was worng ;).

Is it possible to implement a similar camera from the one provided by DirectX?

any help is appreciated

Regards Wolfe
1 Comment
diggit! del.icio.us! reddit!