Do any of you have any recommendations for a new programmer looking at learning physics in use in the CharacterMovementComponent. I’m trying to create my own Tribes Style Movement and I’m having trouble understanding some of the existing items in the CharacterMovementComponents.
I think I just need a better understanding of physics in general so I wanted to see if you guys had any recommendation on finding a good resource. (Having trouble finding one myself).
New to programming in general or new to UE4? (Welcome to programming in either case!)
It can get pretty complex. Spent quite a bit of time myself trying to dive in and get a custom movement system up and running, but more for AI than FPS movement…which I am guessing that is Tribes? In any case, check out this just as a start: UCharacterMovementComponent | Unreal Engine Documentation
Basically, it’s a matter of looking at all the functions, finding one that sounds like you might use, then building something up to test it out. But don’t stop just at this page, be sure to go up the hierarchy at the top of the screen, see the functions behind the class that you can also use. So if you’re thinking something is missing in the component, it could be higher up in the hierarchy. Course…that’s really just a start, but also depends on how comfortable you are with programming if it’s a good start for you.
A good number of these are blueprintable, might be worth testing there (which I usually do) before going to code. Once you start getting stuck on really specific stuff, like a particular vector issue or trace issues, then answerhub and the forums can be a good place for those.
To respond: I’m pretty decent in C# windows programming (WPF and Winforms) but new to C++ and Unreal Engine 4. Have a good enough understanding of C++ to get in trouble though :).
I started out going through code, putting in breakpoints, creating my own CustomMovementComponent class and overriding some functions so that I could see what they did with my custom debug code.
I got pretty far doing that where I fell off the wagon is with the code in the CharacterMovementComponent.cpp ln: 3236 Method PhysWalking(). Specifically under the comment // Perform the move.
There is a while loop here going through MaxSimulationIterations, I’m trying to wrap my head around what that is doing but not getting it, specifically how this while loop plays inside of the loop already being called by TICK already in this context with DeltaTime? What I’m missing I think is some background in general physics math / methodology.
Any pointers on learning general physics you can think of? Google searches don’t turn up much so far and I’m not interested in reading a textbook on the topic :). Trying to find the quick and dirty version to get what I need to know and get out.
Any pointers or tips would be appreciated as I try to learn what Unreal has done with the default CharacterMovementComponent.
Ahh I see. In that case, my own research may not be very applicable to your needs, but when I started getting my hands dirty there was one site that made a huge difference for me. http://natureofcode.com/
From here, it was simply a matter of finding the functions in the CharacterMovementComponent that would accept velocity and apply it to the character. So, for example, I’m doing quite a few processes under the controller classes then just passing a vector to the movementcomponent. Like so:
GetPawn()->GetMovementComponent()->AddInputVector(finalVelocity); (where finalVelocity is the result of my custom calculations.)
Been meaning to put the nature of code link into the forums at some point anyway, and to anyone would recommend supporting the author as I have if it helps your work. For more physics based calculations, like dealing with gravity, falling speeds, etc., could be a few solutions which don’t involve a custom movement component at all. Maybe not, but for me there did come a point where I realized I really didn’t need to make a custom component.
A while back I took some courses like graphics programming 1 and graphics programming 2.
I recall that the game institute guys have courses in game physics, game and game AI too.
I did not take the game and game physics ( I already have a degree in engineering). But out of curiosity, I checked out the syllabi, and they were methodical, comprehensive and easy to pick-up for a beginner. Good luck.
One thing that’s worked really well for me has been to learn Blueprint first. Because it’s the new shiny, there’s a lot of tutorials on Blueprint, including some really excellent official ones form Epic.
After I felt comfortable in Blueprint, I started trying to port the things I had done in Blueprint to C++. If you right click on a Blueprint node, there’s an option that will let you see the C++ function/class that you’re actually using, so if you already understand OO and have a basic grasp of C++, you can really get a good feel for Unreal C++ by creating “Code” projects and porting stuff over.
With the exceptions of the various U macros (UPROPERTY, UCLASS), it’s pretty straightforward. The biggest hurdle is learning where everything is in the engine and what they’re called.