java - 3rd Person Camera View -


i have been trying make 3rd person camera in libgdx past couple of days , can't seem figure out how it. have tried rotatearound function in perspectivecamera, when move camera behind model suppose follow, rotation gets messed up. @ loss @ try now. want camera set , above model , follow it. if point me in correct direction, appreciate it.

in render method of game want update camera follow player @ distance , want make sure camera looking @ right position either @ character or ahead if want on shoulder view.

depending on scale of models may have play around these values.

in render loop want this:

note in example player vector3 , cam perspective camera

this make camera @ character. may want modify values make ahead (change x , z that).

cam.lookat(player.x, 0, player.z);

here set location of camera can see floating behind , above character

cam.position.set(player.x, 10f, player.y-20f)

this updates camera apply of transformations

cam.update();

about rotation i'm not sure, i've not tried it. heres article should help.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -