First/Third Person Controller for BGE

Hi ! :slight_smile:
I am going to create a tool/addon with GUI so that begginers can easily create a third/first person view game inside BGE without touching any codes.
what i have
1.i know basics of python and C++
2.i have all the .bvh animations for characters from mixamo

in the controller GUI there will be three options
1.first person
2.third person
3. custom ( you can put the camera anywhere in the world which will track the character)

everything will be parented to an Empty (the camera,rig etc. )

when a beginner creates a character…he needs to select the character which will open a new tool in the toolbar known as third/first person controller…when he chooses any of the above options the character mesh will be automatically rigged and the camera will be placed…now for the animations he will have a list of options he can add…that will automatically retarget all the .bvh animations to the rig…alot of work needs to be done…i hope someone understands me and help me and help the entire community ! :slight_smile:

If anyone has better solution than please let me know :wink:

Here is a logic based controller,
needs work though,

as far as rigging goes, it’s pretty hard automate,

Some things need to be set to ‚ÄúTap‚ÄĚ

Q-E rotate cam
Z-C Zoom

WAD- move

Attachments

3rd_person_cam_beta (1).blend (469 KB)

that was fun…haha :smiley:
ok lets start making something that creates an empty and a camera ,parents it to follow the empty…can you help me in doing that ? :slight_smile:

Somehow this sounds familiar. Wasn’t such an add-on/plugin published some years ago? I can’t remember.

BTW: First person and third person views are pretty much the same. Just the camera is at different locations.

The control part is pretty much the same too. The common method in this forum is ‚Äúmouselook script‚ÄĚ. It is not that hard and a good start for beginners to get in touch with programming.

There is often an additional demand for third person view to avoid the camera to move through walls. This is a different topic with multiple different solutions but still influences the camera controls. In first person view this is less a problem as the camera shares the collisions of the character.

In general I recommend to create a prototype with logic bricks and Python first before starting with C++. This way you can show your idea is working.


when you click on ‚ÄúAdd CharacterController‚ÄĚ it will add an empty and a camera,parents the camera to the empty depending on the options you choose like FPS,TPS or Custom‚Ķafter that you can change the co-ordinate of the camera right inside the viewport
My next task would be to riggify the mesh character automatically and parent the rig to the empty ! I need some help about how to do that ?

@Monster :Actually it will be an Addon with .bvh files inside it which will load when you create a character controller and it loads all the animations depending upon your choice.the animations will be named and you can choose them in the logic editor ! for beginners there will be auto configuration button which will auto configure all animations with respect to inputs so that they dont need to use the logic editor . :slight_smile:

I would put it in the logic panel rather than the tool panel, simply because you go to the logic panel when you are thinking about creating logic.

Good idea! A must have! Anyone that wants to oppose this, please go and play somewhere else!:smiley:

Having a default animation length, and placement, I could make such a rig easily.

Like frames 0-100 = walk, frames 101-51 turn, frames 152-202 = jump etc.

I would love to see a 3rd person cam implemented.
Im having problems with making one and cant
find one that works stable.
What you should think about it collision with
walls, that is most important, then placement.

Ok, this rig (all be it a tad buggy) will never go into a wall,

now it just needs the ‚Äúmove away from walls‚ÄĚ code and the ‚Äúmaintain line of site code‚ÄĚ

The camera actually has a physics bound, and will bounce off things, and forces can be applied to it.

hold walk forward :smiley:

another note , ‚Äúcamera bounds‚ÄĚ could be put around troublesome scenery , ( an invisible cube)

with this method :smiley:

Attachments

RBJmountedCAm.blend (490 KB)

Wall collision is so easy…Forget colliders and physical floating cameras.

Just raycast for ‚Äúwall‚ÄĚ or similar property from player to camera and move the camera to the collision point if raycast returns anything. This is how cameras were made before distractions of physics simulation.

@Kheetor : i agree with your techniqueIts an addon for begginers

but why need C++??? (already heard and see nothing)
why not add some controller with some interface as brick (ie : some value to setup) that run simply a PYTHON script??(ie : apython that reside inside the folder of blender, not in the text editor)

PS: not, for many kind of mouselook one script is not resolutive, since usually need at least 2 object.
so, or add-on, or something more cool , a button (visible only in BGE RENDER) that add one box dynamic and a camera already parented , and a this point one brick controller to setup some value(sens, CAP) and a python that run inside a blender folder
?? how make other engine ?

when you add a character in your scene (human) its origin is at (0,0,0)…and add CharacterController to it…the Character mesh will be automatically rigged using the meta-rig which will be automatically retargetted to the .bvh files(depends on what you choose FPS,TPS or Custom) the camera’s position can changed in the viewport as you like…everything (the rig,camera etc.) will be parented to an Empty !
The main difference is that you will have a GUI instead of a script or logic bricks…it will be in python…there will be an auto-configure button that will automatically assign keyboard keys to its actions…also i am thinking of implementing AI that we dont have do again and again…all the things you can customize either through the logic bricks which will be automatically created and the script itself…the addon will contain all the .bvh files and the script ! thanks :slight_smile:

Someone has been smoking again.

anyone who can help me with the codes…i am getting some problems…

import bpy
bpy.ops.object.camera_add(view_align=False,location=(0,-4,4),rotation=(90,0,0))
bpy.ops.object.empty_add(type=‚ÄėCONE‚Äô,view_align=False,location=(0,0,0),rotation=(0,0,0))
bpy.ops.object.parent_set(type=‚ÄėOBJECT‚Äô)

You may have better luck asking in the scripting forums, as the game engine python is different, (and I haven’t touched it for years).

Ah now I understand you want to create a sort of ‚Äúlogic-generator‚ÄĚ. So it is like a sort of ‚Äútemplate‚ÄĚ with configuration options.

Good idea.