How to Make a JetPack/Thruster Component?

Hello!

I am trying to create a separate Jetpack/Thruster component that’ll allow me to fly around my map for faster travel. I have already setup the axis binding in the editor and coded the axis binding within my MainPlayer constructor.

My question is how do I add the functionality within my Jetpack component? I’m not sure which function and/or formula to use to actually get my player flying.
I would appreciate if someone can walk me through the steps to get my player moving through the air!

Thank you in advance!!

Are you using a Character, or are you using a Pawn with a physically simulated body?

If Character, you have to set the movement mode to Flying or Custom, and then calculate the velocity to set it on the Character Movement Component manually, every tick.

If Pawn+Body, you simply add a sufficient force (impulse) every tick when the thrust is engaged.

1 Like

honestly
search utube for unreal flying
and unreal jetpack
there are several, all different.

I’m using a Character.
I apologize for my lack of knowledge, but I am unsure how to calculate velocity and where to set it. If you could give me an example to give me a head start, I would appreciate it!

Thank you!

I have tried looking up videos on how to implement the functionality, but everything is in Blueprints and I’m not really sure how to convert all of that to c++. I mainly want to do it in c++ because I am trying to learn how to code as well as learn game development. If you have any resources that implement features in c++, I would love to see them!

Thank you!

well
you can convert blueprints to c++ I believe
they compile down to c++
in bp you can use the “flying mode”
like in the factory pack there’s a drone

Every blueprint node has a C++ function of usually the same name. For example, you can find AddInputVector() in the UPawnMovementComponent class.

You can also look up the implementation of the blueprint node, and see what it does in C++.

Here’s the documentation:

You could start by looking at uses if ConsumeInputVector() in the CharacterMovementComponent, and go from there.
Or you can override the CharacterMovementComponent (and Character, to create your own instance) and add whatever function you need.

1 Like