Game Development Community

rotate player relative to camera

by Paul Clarke · in Torque Game Engine · 02/22/2009 (7:11 am) · 6 replies

I've spent a couple of hours searching and reading now, but haven't found an answer for this.

I've made a few small changes to the 3rd person camera so that it rotates around the player when I move the mouse.
What I want is, when I press W, instead of just moving forward the player should rotate to the direction the camera is facing and then move forward. The same for the other directions aswell, eg: when I press s, the player should rotate and face the camera and then move forward.
I hope this makes sense because I didn't really know how to explain it, any help at all is appreciated.

#1
02/24/2009 (1:50 am)
I'd also like to know if anyone has an answer to this question. I too have searched for many hours and have yet to find a working solution. I've seen a few resources for top down camera views, but I'm not sure how (or if) the same type of system can be made to work for a 3rd person view.

So, does anyone know a way to rotate just the player without moving the camera when using a 3rd person camera view?
#2
02/25/2009 (7:31 am)
I've just found a working solution for this. I used the orbitcam from the Advanced Camera resource
http://www.garagegames.com/community/resources/view/5471
And also some code from this resource
http://www.garagegames.com/community/resources/view/5474
After a bit of effort I was able to get it working the way I wanted it to.
#3
06/07/2009 (8:05 pm)
@Paul Clarke: could you post some details? I'm basically trying to do the exact same thing. I already have Advanced Camera integrated/working, but I haven't quite figured out (set player rotation relative to the camera, with WASD where W is walk away from camera, S is walk towards camera).
#4
06/07/2009 (8:18 pm)
Also, are you sure Advanced Camera resource orbitcam is actually the right thing to use? I noticed that Torque 3D also has a new standard orbit cam.
#5
06/07/2009 (8:34 pm)
Also, if I go with that...

Do I just start from here:
www.garagegames.com/community/resources/view/5474

Or do I actually have to implement this too first?:
www.garagegames.com/community/resources/view/4720

Btw, I already integrated the Advanced Camera resource, but not the second link (Using a Separate Camera Object)

[Edit: I'm using Torque 3D, not TGE]
#6
06/07/2009 (11:21 pm)
Btw, I put more info here:
www.garagegames.com/community/resource/view/5474/3#comments

I got the 8-way directional movement working at least for Advanced Camera resource god view mode, but nothing else yet.