I’m making a game that switches between a physics ball pawn and a standard third person character. I can easily get the Pawn (PhysBall) velocity and apply it to the Character (Player), but since a standard pawn doesn’t come with pre-built character movement, I’m unsure how to do the inverse. All I’m trying to do is make sure if you move when switching to the ball it doesn’t bring you to a complete stop. Still pretty new to UE4 so anything helps!
it depends on how you’re handling the ball movement but try ApplyImpulse
This ^,
Or since the “physics ball” is also a Pawn, maybe you are looking for something more custom like a pawn movement component. Depends on if you need to customize it or require more features than just default physics.
In my own environment, I took apart the tangled character movement component and split it up into 3: (the code to perform movement, the movement characteristics, the pilot) to get the right behaviors for different Pawns. If you go that route I can provide snippets but in C++. BP doesn’t let you customize it all the way I think.
I’m running this code on the level blueprint. Is there a way to do it there?
probably but you definitely don’t want to do it that way.
any reason you dont have it on the ball or in an actor component?
Currently I’m using the level blueprint to get references to the blueprints for the player and the physics ball. It doesn’t seem like I can get references to another blueprint while inside a blueprint that isn’t the level, unless I’m missing something. Is there a way to do that?
the simplest way is GetActorOfClass but this isnt really recommended, its just to start you out.
the correct way depends on your game, but wherever you spawn it returns a reference you can save, or GetPlayerPawn.