Need help with the 3rd Person camera


(TorQ) #1

I have been experimenting with a 3rd person camera setup that I found a tutorial for on Iceman’s site using a camera actuator. It worked pretty well until I wanted my character to move vertically to a different height. Does anyone have any experience with this camera and if so is there any way to make it follow vertical movement? Thanks.

TorQ


(saluk) #2

It DOESN’T follow vertical movement. THis is a strange bug, because it used to work right a while ago (like 2.20?) then it got introduced as a bug, and never got fixed. Even 2.25 still has this annoying bug. I think you can use python to set the height of the camera based on an offset from the character.


#Attached to an always on the camera, as well as an actuator on the player
c = GameLogic.getCurrentController()
us = c.getOwner()
player = c.getActuators()[0].getOwner()

offset = 5  #Change this to whatever height you want

campos = us.getPosition()
playpos = player.getPosition()

us.setPosition(campos[0],campos[1],playpos[2]+offset)

but I haven’t tested this, and it may just be incredibly jerky, so I dont know.


(TorQ) #3

Saluk,

Please forgive my ignores when it comes to using python, but could you explain in a little more detail as to what you mean by “as well as an actuator on the player”

Thanks.


(saluk) #4

You have to select the camera and the player at the same time, and above the actuators make sure that “sel” is selected. This will make the logic bricks from both the player and the camera apear. Just make sure the python controller with the script is connected to an always sensor on the camera, and ANY actuator on the player.


(saluk) #5

By the way, after testing, the script doesn’t even work, so don’t bother:)

The only solution is to write in python (or logic bricks if you feel up to it) your own camera system. Or you can use slow parents, which isn’t the same style as say, mario 64 which is what the camera actuator is going for, but more say, tomb raider. You can set slow parents on the parented object (the camera), from the animation buttons (f7).


(ineedanewbi) #6

awe c’mon ppl… we all know the blender camera actuator sucks crap… well except for newbies i guesse, Z loc doesnt work and the cam gets in bad positions in tight. through walls and stuff

if ur makeing a game just parent it to the character
have u ever played max payne? its a great game, use that kind of cam

just parent it to a rotating object/object that shoots…
… you are making a shooting game arn’t u?

u can make the camera come closer and farther from the player with rays/python… so that walls wont obscure your vision (like max payne and my game)

by the way… has anyone tried useing constraints with the cam actuator?
maybe there is a way to correct its Z location


(saluk) #7

Constraints? They don’t work in the game engine. Except maybe in 2.25, haven’t checked.

But trying to get the camera actuator to work right is pretty much a lost cause, you have to find another solution.


(TorQ) #8

Well Saluk, at some point a while ago you said that I could ask for you to write python scripts for my demo. I know that you don’t have a lot of time but here goes… Would you care to create a third person camera setup similar to the one already in place that works? Of course it would be to the benefit of the community as well as my demo (which has to be done this week) if you would be so kind. You’d also get a place in the credits of my demo. I know not much reason to do it but I think that many would appreciate your efforts :o AND I NEED A COOL CAMERA THAT WORKS FOR MY DEMO!!. :stuck_out_tongue: :stuck_out_tongue: :stuck_out_tongue:

TorQ


(saluk) #9

Updated my site with a camera test I made a few months ago. This should do until I can have some time to write a really good one.

Have fun!