Moving the camera/player a fixed distance

Hi,

I know I seem to be posting more questions than answers, hopefully that will change soon!

The requirement for my game is that the player (camera) moves set distances on a grid of ‘cells’ (to reproduce the movement on old games like Dungeon Master). I’m using a modified version of the MovementForce class I found as part of a Quake3 bsp demo (also used in the Maze3D demo) to move about.

A quick screen shot might explain what I’m on about

http://bencoleman.co.uk/screen3.jpg

I’ve messed about all day trying to stop the force after moving a certain distance, the problem is I either end up overshooting that distance by some small ammount, this error adds up and up and I end up not in the center of my “grid” of cells anymore. No ammount of correcting helps this. I have no need for the CollisionSystem as I know if the character is going to hit a wall from the 2D map array I have.

I understand this is a very specific problem but any clues, the best way to move a character an exact set distance?

Thanks,
Ben

Interesting issue, I know exactly what you are talking about, but I dont think I can help much… All I can offer…

Is your map in an even number of “units” that you can tell your character to move based on the keypress? If so you should just be able to transform the view to that region based on your 2d map… I’d think.

I havent looked at the Q3 code that David released much so I wont be of too much help, sorry.

I’m very close to a solution…
Got the camera to move a fixed distance, just working on the rotating now.

I’ll post a solution when I’ve done.

OK, no closer to a solution,
I still end up jigging the player about when they stop to re-center them on the grid, it looks really wrong.

I’m a bit frustrated that Xith3D has no real avatar/camera etc classes. Surely moving a camera around is standard stuff that all games require… Yet there is no support for it.

Every thing seems such hard work, and I have to write everything myself. I know I should be ashamed but I’m considering moving to Dark Basic or something…

Java Cool Dude posted a pretty nice FPS camera class a long time ago. Lots of people seem to use it. It would be nice if that or something similar could be integrated into the codebase.

Hi,

[quote]It would be nice if that or something similar could be integrated into the codebase.
[/quote]
If someone will prepare it for integration and write small test/demo that demonstrates how to use it, I will add this to main CVS tree.

Yuri

Hi,

It would be nice to have something in the main Xith API for this. In the mean time I have solved my problem. It all stemmed really from using someone else’s class and changing it to suit my needs.

Once I wrote my own camera class from scratch I got it working.
Happy to sumbit my code here for people to use but I suspect it’s a bit too specialised. I’ll be putting all my work on my website soon anyhow.

Thanks,
Ben

A 3d engine without a built in camera class that does basic things like moving and turning? You are kidding, aren’t you? Or is there a good reason for it?

There is a class that allows the moving and turning the “camera” it’s the View class. What I was saying I think we really require is a more “game-like” camera class that moves with the player.

Well, i really don’t understand your problem then. You know the dimensions of your grid, so you simply have to move the camera by that amount and rotate it 90 degrees for turning. There must be something in your post, that simply don’t get… ??? Anyway, you got it working already. ;D

java -
I could have move the camera a fixed distance and turned it 90 degrees without much problem at all.

What I wanted was the player/camera to move and turn smoothly between these fixed interval grid points and not stop anywhere between.

In retrospect I probably wasn’t that clear in my post…
Oh well it’s fixed now

Thanks for your interest,
Ben