Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Third Person Shooters - Camera and Player Control

Author
Message
ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 22nd Oct 2009 10:42
Hey guys, I'm trying to make a third person shooter and I'm having a lot of trouble getting the camera and player control right.

I currently have a player object and a control object which can move around the player object (forward, back, strafe left/right).

What I need help with is the camera placement. I need the camera to act like a third person view, so that its over the shoulder of the player and when the player rotates the camera it also rotates the player object.

I was wondering if you guys could make a few suggestions for me on how to get it working right.

Also, any code samples would be appreciated.

[Below is my code, but its such a mess because it doesn't work at all]

_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 22nd Oct 2009 11:40
I think the easiest way to do this, is to first position the camera at the players position and rotate it as you need.
Then you just move the camera out a certain distance.

Here is an example:



Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 22nd Oct 2009 12:29 Edited at: 22nd Oct 2009 12:39
Wow, thanks!

A simple solution that works very perfectly.

I actually have another question for you, although this one is in FPS.

I want the model to be there in FPS mode, because I hate looking down and not seeing your models body. In this case, I just rotate the model and the camera at the same time, however I need to place the camera at a specific position so that it looks like your looking from where the head is. I need to do this in 3D, so I'm not sure how I would be adding to the Z value when the object has moved around.

Below is the commented code that I have so far.

_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 23rd Oct 2009 13:08
I think you can do this with these commands:



But I'm not quite sure how to use them in this case, but in general they are handy in situations where you need a 3d position relative to an objects angle.
I'll post back if I have a suitable solution, but I have stuff to do right now...

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 23rd Oct 2009 13:13
Well, ok the x & z position would be like this:



Hope this helps...

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.

Login to post a reply

Server time is: 2024-11-20 11:46:41
Your offset time is: 2024-11-20 11:46:41