Now, i have 2 blueprints (pawn class) uses as 1)3rd person controller; 2) top down view controller.
I would like to, say, press “Q key” and switch between each other?
What should i look into? I have tried casting seems not the right direction.
(Before anyone ask, it is NOT changing cameras only.
3rd person have usual action game control and the top down have a “drag” control and cannot change camera angle, just like AOE)
I may be asking really dumb question, but please try pointing me in some direction.
thank you very much!
A controller can possess pawns that implement their own camera and their own controls. Consider having 2 pawns. This comes with a side benefit of having some shared controls.
shared controls go into the Controller - behaviours that can be utilised by both the 3rd person and top-down modes: bringing up the menu, switching between pawns, showing minimap, inventory - these always work regardless of which mode we’re using
3rd Person Pawn has its own camera and a unique Input Mapping Context (actions, camera controls, casting spells and whatnot)
Top-Down Pawn has its own camera and a unique Input Mapping Context (dragging, selecting units, issuing orders)
Problems:
A: Both characters needed to be already on the scene
B: Cannot change control method
Possible solutions to problem:
A: Just hide the un-wanted character when one is possessed
B: i have no idea
it is basically opening different games in some sense, items/ destroyed environment will be gone…
Of course using two different will make the problems go away,
however, i might need to have the level remain the same when changing the blueprints in the future.
BTW, i found that my “top down” blueprint is a “pawn” class but the 3rd character is a “character class”…
Is this even an issue? Besides that, you can spawn anything you wish dynamically. I’d probably Game Mode → Default pawn the top-down as it should always exist. Not sure what the purpose of the 3rd person is, but it seems like it could perish…
Cannot change control method
Yes you can, the controls go in to the possessed pawn. Also, look into enhanced input. You have entire mapping contexts available. Changing between sets of controls is trivial these days. Technically you wouldn’t even need to have the controls in pawns - but it may be neat for organisational purposes.
Currently my setup is having both actors “actually placed” in the map, so that i can drag them into the blueprint (as reference? i suppose)
And by pressing the “Q key” to toggle and hide the other one are the same time.
It works, for sure. However i think i am not doing things correctly.
(In my mind it should be something along the line of " press key> spawn top down> destroy 3rd person character", of course that will lead to issue of having to “remember” the last location of the character etc…)
So i think the next thing is just to change the way i spawn the characters and how to “put” them in the blueprint when they are not “on the map”…
Spawning / destroying is expensive. And destroys data (the location, for example).
Hide / show may work better.
Place the 3rd person mode char in the level; have the GameMode create the top-down, the Player Start helps with initial placement but is not strictly necessary.
Have the player controller (not the LB) switch between them, hiding what needs to remain unseen.
I believe that is the goal here, right? Switch between two pawns, each with unique controls and view perspective.
The only problem is that, once i switched to the third person and switch back,
the control are somehow connected… i.e. it moved the top down cam when i was in third person view
to make things clearer:
start game at 3rd person
move around using mouse
press Q to switch to top down (location is correct, input wasn’t “pressed”, check via debugger)
4)press Q to switch back to 3rd person, move around
5)press Q to switch back to Top down, now the cam is moved.
Its funny that i tried “W A S D” at Top down mode and the character wasn’t moved…
And the cam wasn’t moved either when the game begins…
I suppose i haven’t (as a matter of fact i don’t even know what’s that, blueprint-wise)
As for mapping… I have used " input > binding> action mapping", does that count?
Would you be so kind letting me know what to looking into for:
unique control
mapping context
Thank you very much for kept answering my questions!