Camera Following Object (3rd Person Perspective)

Post: #1
Alrighty, in RB3D, I want my camera to follow my player object(3D).

So, when my player object moves (the yaw changes, and it goes off wherever), how do I make it so the camera stays X units behind it at all times (and, X units above it)?

I'm kinda foggy on how to do it; I know it must have something with setrotateaboutaxis, but I'm not sure how to do it...any code/examples will be much appreciated!

player.goforeward 10
[What goes here to make the camera stay behind it???]
Quote this message in a reply
Posts: 130
Joined: 2002.04
Post: #2
Hmm, ok.
I just added this code to the offworld project, so it should work

qcam =
qcam.x = mShipState.mObject3D.orientation.x
qcam.y = mShipState.mObject3D.orientation.y
qcam.z = mShipState.mObject3D.orientation.z
qcam.w = mShipState.mObject3D.orientation.w

campos =
v = mShipState.mObject3D.position
campos.x = v.x
campos.z = v.z
campos.y = v.y
View.Camera.MoveForward -175

Hmm, I just realised you could probably use campos.Copy v instead, but I don't know since that command has been added(or at least I didn't know of it) when I used RB3D.

mShipState.mObject3D is the players object3d and view is the RB3DSpace.

Oh, and MoveUp is a method to move a object3D up that I've added. I think I took it from Franks 3D sound example.

"Gameplay Uber Alles. And if you can make it psychedelic too, great!" - Jeff Minter
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  How do I apply a perspective transform to a UIView and add to cocos2d sefiroths 0 4,886 Sep 24, 2012 05:45 AM
Last Post: sefiroths
  Switching To Third Person Nick 9 8,245 Mar 31, 2005 12:14 AM
Last Post: lpetrich
  First Person Shooter Nick 14 10,678 Mar 19, 2005 04:26 PM
Last Post: Frank C.