Game Examples

Nov 28, 2012 at 4:39 PM

Is there any example you can provide with a character controller and camera following the character. I'm trying to understand the follow camera but when I look at examples you have the right and left controls move the character left to right and not really rotate the character which is what I'm trying to do.

It would be neat to get an idea of how the physics works.

Developer
Nov 28, 2012 at 6:38 PM

It seems that the camera is not updated as it should be. Else it is working just fine.

Example:

drawingContext.Camera = new ChaseCamera(GraphicsDevice)
{
	Target = scene.FindName<Transformable>("Player"),
};

I don't know how this is used in Xaml tho. I was assuming you were talking a bit about the ChaseCamera :)

Eric

Nov 28, 2012 at 9:43 PM

What about rotating. I've tried using Matrix.CreateRotationY(MathHelper.ToRadians(1)); but that just swings the character around and doesn't rotate the model. I would like it to pivot.

Developer
Nov 28, 2012 at 9:45 PM
Edited Nov 28, 2012 at 9:51 PM

I did use ( Just for test )

if (keyboardState.IsKeyDown(Keys.Right))
                transform *= 
                    Matrix.CreateTranslation(-transform.Translation) *
                    Matrix.CreateRotationY(-RotationSpeed * elapsedTime) *
                    Matrix.CreateTranslation(transform.Translation);

But we have to do something about this, maybe a easier way to control it.

What do you mean about privot?

Coordinator
Nov 29, 2012 at 2:43 AM

You can only build your own transform matrix as of version 1.4. This could be made easier, more samples and updates on this is expected in the next major release.