I’m just starting with blueprints. Have one question about movement:
my goal is to make player move when I press mouse button on empty space, do I need some “invisible collider” to get point where to move? I looked at the template but my character not moving at all.
here is a image of blueprint:
might be that you need a Navigation Mesh. I don’t have a TopDown Point and Click Template downloaded right now, but
check if the Template has a NavMesh in it’s outline (you can also toggle the NavMesh visibility in the Viewport Settings at the top of the viewport).
Otherwise the “MoveTo” function doesn’t know where to move.
Is the “MoveToHitLocation” function a custom one or does that ship with the PlayerController?
If it’s custom it would help me if you could open that up and show me (:
With this you could do a normal “LineTrace” (Unity: RayTrace) of a specific range. If you hit something, you take the hit point
for stuff. If you don’t hit stuff, you just take the endpoint of the trace as world location to travel to.
Though i have no idea how to implement your actual movement in space. Never done this.
All cool (: take it slow. Copy over your project one by one and if you get stuck, just ask. Framework is a bit different to Unity so it’s easy
to get confused. But once you get the idea, you will copy the rest pretty fast.
I’m actually watching Unity “tutorials” about stuff and implement them in UE4. It only takes some time to get used to it (:
Use “GetPlayerController” and from it you can get the Convert node. I think it’s a PlayerController function (:
You can use that where ever you like.
If often decide between PlayerPawnBlueprint and PlayerControllerBlueprint by answering the following question:
Does the Player need to use this Input even if the PlayerPawn is destroyed or just not available/changed?
If not, then you can place it in the PlayerPawn. But if you need it to be working even if the PlayerPawn is destroyed or not the
same (for example switching from Human to Car Pawn), then you place it into the PlayerController.
First thing i see is, that you use “Pitch”. The UP-Axis in UE4 is Z (Yaw). So you need to use that.
And you don’t need the “Make Array” for “Actors to Ignore”. I mean, you left them null anyway.
Then i would move the “Branch” and the Boolean INFRONT of the LineTrace.
Why Tracing if you don’t want to rotate? Saves a bit of performance in the long run if you always make
sure stuff is not called if you don’t need it.
(Side Node: Maybe put all the “EventTick” stuff into a function to clean up the Event Graph)
Then you need to check if your Character is using the “ControlRotation” to be rotated. Because then
“SetActorRotation” won’t do stuff. Then you need to get the PlayerController again and call “SetControlRotation”
and plug the “MakeRotator” ReturnValue into that instead.
(Another Side Node: Make sure to use the “ReturnValue”(Boolean) of the LineTrace so you know if you hit something at all.
You are getting the DisplayName of the HitActor without even checking if that thing is valid. Making sure (with the Boolean)
that you actually hit something is important to avoid “Accessed None” Errors. A simple “IsValid” check on the HitActor would
hey. Ok about I hit something or not, I dont know I did good or bad but I put sphere inside player BP (scale=100) so every time I hit mouse button I getting on screen player_number(I guess it is hitting sphere). i think this is good because I have point where to rotate and go (the same principle I used in unity)
Now I will look into how to check my character is using Controller rotation or not.
And what do you mean “put all the “EventTick” stuff into a function”?
Ah, so you trace the sphere? Yeah ok, i thought you trace your surroundings.
Yeah well, the line trace stuff. Make it a function. You are currently working in the EventGraph directly. Making stuff into functions should always be the first thing
to do when creating new logic. I don’t think you put every code you had directly into the Update functions of Unity, but created functions that were called.
You mean the component on the left? This is from the “ACharacter” C++ Class. If you don’t need it, you should use a “APawn” which is the Parent of “ACharacter” and does not have
the CharacterMovementComponent. But i think you need that for the MoveToFunction stuff.
You can’t override that in BPs i guess. You would need to override it in C++ and create your own Child of “APawn” where you add your own overridden CharacterMovementComponent Class.
So in fact, create your own “ACharacter” class from which you then could create a BP Child again.
But for what do you need to override stuff in that component? Is there something specific you thought about?
I think I can use that movement class. I just want to have a proper name on these different movement(like run, walk…), you know space ship flying
And in my game there will be more than one ship for player to choose with different speed and other stuff.