Proper camera etiquette

Blitz3D Forums/Blitz3D Beginners Area/Proper camera etiquette

PureDocHale(Posted 2013) [#1]
hello again everyone, I have begun my project after my modelers have begun to figure out blender and it's intricacies. So far I have had no problem getting back to my roots in setting up the world, and decent looking character, lights etc. the stage is set, but for a few roadblocks I have been hitting.

I have had one of those days in programming, that I am sure everyone remembers where despite your best efforts your goal eludes you, and you physically abuse the punching bag next to the desk in your office.

I have set up a Player model, which is parent to the camera. I have had luck in positioning and zooming the camera just fine. --- but I am having trouble allowing the camera to look around in a manner similar to other 3rd person games.

-I don't ask lightly, I have seen other examples of camera use in the forum's past entries, but their explanation and execution seems like something from NASA. I need an example following my philosophy K.I.S.S.

-I want to thank you guys for lending me your ears ahead of time!!!


Kryzon(Posted 2013) [#2]
Hi. Show me what you got.
I'd like to work over your code, you can learn better. If you had to say a specific game's camera-style you're trying to imitate, which game would it be? Even just saying "third-person", there's still some different flavors.
I don't ask lightly either.


RemiD(Posted 2013) [#3]
Nice demo Kryzon :)



PureDocHale>>
Here is an example with simple controls, collisions, first person view and third person view :
http://blitzbasic.com/codearcs/codearcs.php?code=2933

Take a look at how the camera is set as a child of "PlayerEyes", and how "PlayerEyes" is set as a child of the "PlayerCollider" (his feet).
Then to turn the camera left or right, it is is the "PlayerCollider" (the feet) which is turned, and to turn the camera up or down, it is the "PlayerEyes" (the eyes) which is turned. The camera being a child, it follows the orientation of its parents.


PureDocHale(Posted 2013) [#4]
Thanks guys,

RemiD-->
That example is exactly what I was trying to accomplish. Very good job on the code, kudos. I will be implementing my camera in a likewise fashion.


jfk EO-11110(Posted 2013) [#5]
I don't know exactly who you're referring to by " the punching bag next to the desk ", but here's another one that may contain some useful elements:
http://www.blitzbasic.com/codearcs/codearcs.php?code=2724


RemiD(Posted 2013) [#6]
Very nice demo jfk, i will study this. Thanks


PureDocHale(Posted 2013) [#7]
I really like your example jfk, love the flahlight effect, & smooth camera, I might have to try and make my camera smoother by looking closely at your demo. Very nice!


Now I am trying to put in a camera mode that orbits the player, to allow the character to get a good look at himself. I am thinking of putting some pivots surrounding the character and moving the camera between them, by tracking the coordinates of the camera & comparing it to those of the orbit pivots. <-- gotta be a simpler way though

-Again jfk, Remi, thanks for the assist

<-- oh and the punching bag is a literal punching bag :), no animals or people (that matter) were harmed in the making of this program


PureDocHale(Posted 2013) [#8]
Never-mind the camera orbiting the player question. I was really over-thinking it. I just needed to set up a pivot that was used to be a temporary parent to the camera facing it, and turn the pivot.

I have picked up on pivots being parented and re-parented are the key to the camera.


jfk EO-11110(Posted 2013) [#9]
pivots are indeed very useful for eg. an orbiting camera. you could also do it that way:
repeat
positionentity cam, px+sin(a#)*d#, 5 ,pz+cos(a#)*d#
pointentity cam,player
a=a+1
if a>360 then a=a-360
renderworld()
flip
until keyhit(1)

where px,pz are player x,z and d is the desired distance.