Making Third Person Camera

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
turshija
Posts: 127
Joined: Sat Feb 17, 2007 9:26 am
Location: Novi Sad, Serbia
Contact:

Making Third Person Camera

Post by turshija »

Ye, Ye,
after some time of thinking and screwing around with trig functions, I finally figured how to make camera follow your model and rotate the same way your model is rotating ...
Angle is Model rotation, and Distance is variable you can change in the game if you want to have zoom-in and zoom-out functions ... :)
anyway, enjoy, hope you'll find it useful :)

Code: Select all

App.CameraPosition.X = CurrentModel.Position.X - ((-1) * sin((angle)*2*pi) * Distance);
App.CameraPosition.Z = CurrentModel.Position.Z - ((-1) * cos((angle)*2*pi) * Distance);
App.CameraRotation.Y =  1 - angle ;
Post Reply