Third Person Game From Scratch with Godot P2 : Camera

  Рет қаралды 15,757

Ombarus

Ombarus

Күн бұрын

Don't put your camera inside the player. Think of all the possibilities! How to make a Third Person Shooter (TPS). This is my take on implementing the 3Cs (Character, Controls, Camera)
Animations from ► www.mixamo.com/
Prototype textures downloaded from ► www.kenney.nl/...
Godot Game Tools - GGT ► viniguerrero.i...
Question? Suggestion? Threat?
Talk to me on Discord ► / discord
Check out my game!
******* www.solar-rogu... *******
STEAM ► store.steampow...
ITCH.IO ► ombarus.itch.i...
ANDROID ► play.google.co...
IOS ► apps.apple.com...
************************************************
Follow me and support me, check out these links :
Support me on Patreon ► / ombarus
Twitter ► @Ombarus1
Instagram ► / ombarus1
Website ► www.ombarus.com
Email ► ombarus.dev@gmail.com
Github ► github.com/Omb...
Music ► www.bensound.com
My name is Ombarus and I'm a programmer / game developer from Canada who moved to Japan and decided to try my own luck with game dev.

Пікірлер: 61
@Ombarus
@Ombarus 3 жыл бұрын
I'm not sure I made myself clear when explaining the layering concept of the camera system. 1. anchor_offset is relative to the player 2. target_offset is relative to the player + anchor_offset 3. rotation is relative to player + anchor_offset + target_offset 4. look_at is relative to everything else! It's important to keep that in mind when you want to manipulate the camera later using these parameters. (for example a shake on the look_at is going to look completely different than a shake on the anchor_offset, but both could be use in certain circumstances)
@wiktorwektor123
@wiktorwektor123 3 жыл бұрын
Good job with that camera, nice I could help with some coding.
@vinay_dias
@vinay_dias 3 жыл бұрын
Thanks for your contribution Godot community is becoming stronger 😊👍🏻
@canht95
@canht95 3 жыл бұрын
I love beans, but yes, your way is the best. Like the hard way.
@davidjack9643
@davidjack9643 2 жыл бұрын
Im glad you know about the power of the simple bean
@demetriusharris2169
@demetriusharris2169 3 жыл бұрын
i feel like crying
@jikkermanccini
@jikkermanccini Жыл бұрын
I would love to see a new version of this tutorial in Godot 4! I'm developing a game where the player changes shape and size fluidly throughout combat, and this camera setup is perfect for what I need with the ultra precise controls.
@kirbbeans9583
@kirbbeans9583 2 жыл бұрын
i automatically love this guy for the karlson joke
@javisartdesign
@javisartdesign 3 жыл бұрын
Awesome tutorial, didn't know about the nodepath export tip to get the nodes directly. Thanks!
@theodoreclaftover4212
@theodoreclaftover4212 Жыл бұрын
Thanks for the great video tutorial. I'm very proud that I think I got this working in Godot 4 beta with a few modifications but I'm wondering as I'm trying/struggling to get the camera oriented onto the player - is setting cameras up this way overkill in godot 4.0. Its a tad overkill in my game only because of design choices I've made but I liked the idea enough to get it running in case I need the extra camera tools you have provided.
@Ombarus
@Ombarus Жыл бұрын
It really depends on what you're planning to do. I wanted to show a way you could handle more complex camera setup for something like a large game with lots of camera effects, movement and transitions. If you can get 99% of what you need with the built-in godot nodes and some smoothing then this might be quite overkill.
@theodoreclaftover4212
@theodoreclaftover4212 Жыл бұрын
@@Ombarus well it is getting the job done nicely
@theodoreclaftover4212
@theodoreclaftover4212 Жыл бұрын
@@Ombarus I am still loving this camera but I've run into a snag. My game uses 3D assets with a 2D perspective like New Super Mario Bros sometimes called 2.5D. When my character rotates from left to right in order to face and move along the x axis, the camera swings around the Y axis to the back of the scene switching between z and -z if that makes sense. I think I understand why this happens, this camera is basically a selfie stick and it does it's job well. But for several days I've been unable to think of a clean math/code-based solution to fix it. My next attempt if I don't hear back from you will be to attach the camera to a node that follows the character along the x and y axis while remaining z distance away and see if that works.
@wojtek_pe
@wojtek_pe 3 жыл бұрын
Will this approach not result in a camera lag/stuttering in some cases? Shouldn't we be using _physics_process for such things?
@bitmammothOG
@bitmammothOG 3 жыл бұрын
My Camera is snapping from view to view when trying to use normal mouse input. I hope he will cover how to fix these issues the rest of this controller is awesome!
@siyabonga.fortune
@siyabonga.fortune 2 жыл бұрын
Legendary!!!!! Thanks a bunch! :)
@alvarocafe
@alvarocafe 3 жыл бұрын
Thank you, keep up the good work!
@stefanfranuszkiewicz1249
@stefanfranuszkiewicz1249 Жыл бұрын
I can not find the newCameraData as it does not show up in the Godot workspace
@adrijpaul4865
@adrijpaul4865 2 жыл бұрын
9:20 I can't find the CameraData in the list can anyone help me with the issue
@xzwells
@xzwells 2 жыл бұрын
I had to relaunch the editor for it to show up
@provensi
@provensi 2 жыл бұрын
I do like your approach, but for me is more readable have multiple cameras instead, maybe too abstract for me? maybe. Why don't you share you code/project with us?
@provensi
@provensi 2 жыл бұрын
i mean, this one, 'cause your github is niice
@RANPA_RANMARE
@RANPA_RANMARE 3 жыл бұрын
6:48 bruh, u know what the people really want XD
@MrHermesTrismegistus
@MrHermesTrismegistus 2 жыл бұрын
The events InputEventTouch and Drag not working by default, inputEventMousebutton does, instead of drag i used InputEventMouseMotion, but then i can not look up and down. Why does inputEventTouchTouch and drag not working by default?
@Ombarus
@Ombarus 2 жыл бұрын
In the project settings, in Input Devices you might need to set Emulate Touch From Mouse.
@MrHermesTrismegistus
@MrHermesTrismegistus 2 жыл бұрын
@@Ombarus Your right, it works now. But now i have one problem left, i cant look up and down. Is there a possibility this is also caused by a setting, checked the code severall times and dont found the mistake yet.
@MrHermesTrismegistus
@MrHermesTrismegistus 2 жыл бұрын
@@Ombarus drag camera up and down stops working after as you mentioned to change look_at = look_at.rotated(up_down_axis, setup.rotation.y) to look_at = look_at.rotated(up_down_axis, setup.rotation.x) With the y, i can look up and down but like in your vid its messed up. When i change it to x, i can only rotate to left and right and not up and down.... Any chance you can add the code to git page so we can copy it. Did watch, your tutorial 3 times now to see if i have a any typo somewhere, but not found any yet....
@RafaelSales55
@RafaelSales55 3 жыл бұрын
Excelent tutorial, thank you!! I would like to become a good developer like him, should I just keep making games? Read books? or something else?
@Ombarus
@Ombarus 3 жыл бұрын
Whatever keeps you motivated to improve!
@GlassYT
@GlassYT 3 жыл бұрын
Quick Question. How did you draw the line that tracks camera in the last scene? :D
@Ombarus
@Ombarus 3 жыл бұрын
Just a very thin cylinder mesh attached to the camera :).
@krempelritter9950
@krempelritter9950 2 жыл бұрын
Thank you for this video :) I've run into a problem I can't solve: around 9:18 you select 'New CameraData' in the Camera's setup. I do not have this option. The only 'New Camera...' I have in my list is 'New CameraTexture'. Does this option appear only after you put the 'class_name CameraData' in the CameraData script (which I did, of course)? I checked both the Camera and the CameraData scripts multiple times and they match yours exactly. Is there any other way to get to the CameraData variables in the Camera script? I've also tried 'New Resource' instead of 'New CameraData' and linked the CameraData script as a resource, but this still doesn't give me access to the CameraData variables in the Camera script. May this be a version difference? I'm using 3.4.2.
@z3r0c00l
@z3r0c00l 2 жыл бұрын
Same problem here. Just upgraded to 3.4.2, i think this is a version problem, i am searching for a solution too
@z3r0c00l
@z3r0c00l 2 жыл бұрын
Ok, i solved, try godot mono version with fcking c# support, then it works
@iMGMoosic
@iMGMoosic 2 жыл бұрын
I have a way to do this in 3.4.4 (which I assume can be applied to earlier versions). In the filesystem pane, right click and select New Resource..., then search for CameraData, and you'll eventually see CameraData (CameraData.gd). Click that, then save the new resource as whatever you want (I used CameraData.tres for obvious reasons). Then when you click on Setup, scroll all the way to the bottom, click Load, and then load the .tres file you made. Hope this helped! :)
@cyberred16
@cyberred16 2 жыл бұрын
"shoes" sigh.... Comment section it is then!
@KillerFliege
@KillerFliege 2 жыл бұрын
Where get you this edit view while running? I miss this feature in Godot. Thank you
@Ombarus
@Ombarus 2 жыл бұрын
Are you talking about the split view when I show how the camera is moving? that's something I made myself using a different Viewport with a ViewportContainer for illustration purposes. It can be a bit tricky to setup properly.
@KillerFliege
@KillerFliege 2 жыл бұрын
@@Ombarus yeah exactly this. Thank you. Sadly Godot hasn't this on board... With Unreal and unity is this standard. This is a must have for debugging, specifically for procedural generation. Thanks mate for this fast answer.
@canht95
@canht95 3 жыл бұрын
Why are the pitch and yaw vectors? Shouldn't they be scalars since they are angles?
@Ombarus
@Ombarus 3 жыл бұрын
The min/max pitch I put in a vector2. Otherwise I combine Pitch, Yaw and Roll in a single Vector3 instead of keeping them separate
@itsME-dc4vm
@itsME-dc4vm 3 жыл бұрын
Nice ;D
@hydrak6346
@hydrak6346 3 жыл бұрын
Thank you so much for this tutorial and all the knowledge you share!! This series help me a lot!! From minute 20:28 you can see a blue triangle for the camera view and a "line" between the camera and the anchor point, I wonder what I have to enable for see them too ? Thank you for your time!!
@Ombarus
@Ombarus 3 жыл бұрын
I did that for the tutorial... It's just a 3d camera model and a very thin cylinder MeshInstance attached directly to the camera node. Sadly it's not just a simple switch you can turn on (though it would be nice!)
@hydrak6346
@hydrak6346 3 жыл бұрын
@@Ombarus Thank you anyway :)) By the way this series you make is something amazing!! Full of good content and a Must for who want to learn and improve !!!
@cintron3d
@cintron3d 3 жыл бұрын
Thank you, lots of good tips here. I wonder what the impact of setting self.transform_origin multiple times in the same function. Is that really safe to do?
@Ombarus
@Ombarus 3 жыл бұрын
You certainly could put everything in a temporary variable but I'm pretty sure the impact is negligible.
@Deadshot-vp3uo
@Deadshot-vp3uo 3 жыл бұрын
Hey you can also use interpolated camera in godot to follow the player Rather than doing this all stuff .
@Ombarus
@Ombarus 3 жыл бұрын
Very true. I'm talking from the perspective of making a bigger, more polished game. You'll usually want to have very tight control over the camera and in my experience the built-in stuff will often end up in your way more than helping. That said, if you're just starting, save yourself some time and use the built-in stuff!
@deerdev6511
@deerdev6511 2 жыл бұрын
So currently my camera just kind of flips itself around on the very top/ bottom and continues the movement back down/ up even though it should be just going above the character and continue so the world is upside down (very bad description I know, if you need more information feel free to comment) I don’t think it’s gimbal lock because it isn’t fixed with the clamp function. If someone has suggestions feel free to comment and have a lovely day
@shreddage2932
@shreddage2932 2 ай бұрын
Have you found a solution? The camera turns exactly as you described
@deerdev6511
@deerdev6511 Ай бұрын
@@shreddage2932 Hey, unfortionately I have given up on this aproach and have not touched camera mechanics since. I have tried a lot and simply could not get it to work. Im sorry, maybe in the future, should I pick it up again. I wish you the best of luck though
@keanumarquez5769
@keanumarquez5769 3 жыл бұрын
why my " if event is InputEventScreenDrag and _pressed =+ false: " is not working. any tips?
@Ombarus
@Ombarus 3 жыл бұрын
Try to print the type of event you receive to make sure InputEventScreenDrag is triggering. Might also want to print the value of _pressed
@keanumarquez5769
@keanumarquez5769 3 жыл бұрын
@@Ombarus Thanks
@RafaelSales55
@RafaelSales55 3 жыл бұрын
it's not working here too, I tried to change for InputEventMouseButton and it does work
@JusGodden
@JusGodden 3 жыл бұрын
Go to "Project">"Project Settings">"General">"Input Devices">"Pointing" (if you don't see the word 'pointing', click on the words 'Input Devices' and it will appear). Put a tick in the box "Emulate Touch From Mouse". It is not enabled by default.
@RafaelSales55
@RafaelSales55 3 жыл бұрын
@@JusGodden thank you a lot
@OoSHLo
@OoSHLo 3 жыл бұрын
can you please share the camera and setup code?
@monyettenyom2540
@monyettenyom2540 2 жыл бұрын
Hi, I copied all the structure and Codes, but still, in the camera.gd I got 'Invalid get Index 'look_target' (on base: 'Resource(CameraData.gd)').' Can someone help me out here? @ombarus
Third Person Game From Scratch with Godot P3 : Controls
21:54
How One Person’s Passion Project Became an Award-Winning Game
26:19
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 20 МЛН
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 8 МЛН
ТИПИЧНОЕ ПОВЕДЕНИЕ МАМЫ
00:21
SIDELNIKOVVV
Рет қаралды 1,4 МЛН
The Best Frameworks For Game Development
14:48
Gamefromscratch
Рет қаралды 23 М.
Third Person Game From Scratch with Godot P1 : Character
21:41
Why you Draw Bad Assets || 2D Game Art
13:00
Nonsensical 2D
Рет қаралды 72 М.
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
DevLogLogan
Рет қаралды 527 М.
Did I make money selling my game?
15:23
Ombarus
Рет қаралды 4,9 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 621 М.
Insane Huge Terrain 10,000 square km - Godot engine
9:18
mohsen zare
Рет қаралды 9 М.