I’m working on a 2D game and I am looking for a solution that allows me to set a degrees value in the editor under the pawn attributes so that it can get spit out in a formula that defines the impulse of the object as it ticks.
I’m using twinStickShooter as my basis, and I already understand how to define a UPROPERTY to get it editable in the editor. I’m just kind of tangled up in FVectors, Rotators, FRotators etc All I know is I need an FVector to feed to the impulse.
An impulse is a short force push in a direction, so it obviously needs to be a vector. The direction of the vector is the direction of the force and its length is the amount of force added. Could you explain in a little more detail what you are trying to do? Are you attempting to add an impulse in a certain plane only (xy-Plane, i.e. on the ground?) and want to define the direction by an angle from a certain axis and the magnitude in a different variable? If so, the components would be
Hey thanks for replying. Ok that makes sense. I was just having issues working through the spaghetti of calling so many functions inside FVector and I wasn’t sure if I was supposed to be using FRotator to store the degrees (looks like that’s a no!).
So essentially I could make float vars to fill in for ‘degree’ in your example. Ok that’s great, thank you!
const FVector MovementDirScratchVec;
blahblah execution stuff blahblah
MovementDirScratchVec(DegreesOnXYToFVector(FlapLeftDegrees));
Nor could I replace the above with this:
MovementDirScratchVec = DegreesOnXYToFVector(FlapLeftDegrees));