Change controls of a camera actor in Game Mode - unreal-engine4

I'm attempting to follow a beginner tutorial on UE5 but I'm currently stuck very early on.
Since I'm using an AZERTY keyboard I'm trying to change the control of UE to fit my needs, I had no problems re-binding the viewport camera controls, but once I click "Play", the camera actor is only responding to WASD controls, and I cannot find a way to switch it to ZQSD.
The project I'm on is a simple blank Game template, so there is no actual PC when I click play, it's just a camera that I'm trying to control to move around my world.
As suggested in several other posts, I tried going to Edit > Project settings > Engine > Inputs > Axis Mappings and creating a MoveForward mapping for Z with 1.0 scale (and for S with -1.0 scale, on my second attempt) but nothing is doing the trick...
Looking for some help on that one, thanks!

If you have not provided an Overridden Pawn for the PlayerController to possess in the GameMode Override default classes. You will have spawned a DefaultPawn.
The DefaultPawn has hard coded Input Controls that cannot be changed.
I suggest that you create your own Pawn with its own Controls that you can then decide on what Input Keys manage particular Input Actions.

Related

How to modify behaviour of a VR controller's pointer

My university colleagues and I are trying to develop a Virtual Reality project for university where we use an Oculus headset and create a scene with a mouse where you can select and click and drag different objects in the scene. You are supposed to be stationary and move one of the controllers as if it was a mouse. However, we want to modify the behaviour of the controller to better fit the 3D environment. When an object is not selected, we want to interpolate the depth of the cursor according to the interpolation of the nearest objects. There is a paper that we were shown in class that we are supposed to drag inspiration from, and it achieved this kind of behaviour of the cursor with a normal mouse but I can't seem to find any information on how they did it. Our final goal would be to compare both ways of managing the scene and assess which one is better. We are using Unity with VRTK as suggested by our professor, but we and can't really seem to be able to access the mouse's file on how it moves or its behaviour, and we are kind of lost on where to go. Could someone help with this?
Here is the paper where they talk about it:
https://dl.acm.org/doi/pdf/10.1145/3491102.3501884
We so far have tried creating a simple scene and adding objects with different behaviours as well as a controller instance, but we seem to only be able to modify the events of the mouse and not its specific behaviour.
Kind regards and thanks

How to create a custom height snapping tool in Unity Editor

I am making a strategy game and I need to have a tool which places the objects above the terrain while I am dragging them in Unity Editor when I work on level design.
Basically I want to get result like here:
https://www.youtube.com/watch?v=YI6F1x4pzpg
but I need it to work before I hit the Play button in Unity Editor.
Here is a tutorial
https://www.youtube.com/watch?v=gLtjPxQxJPk
where the author of it made a tool which snaps the object to the terrain height when a key is pressed. I need the same to happen automatically whenever I place an object over my terrain. And I want my tool to adjust the Y position of the object automatically even while I am dragging it inside of the editor.
Also just to clarify: I don't need grid snapping and I don't need this functionality during the gameplay. I just need to have a tool for my level design work.
Please give me a clue where to start with it.
Thanks!
There is this tag you can apply to classes so they do call their regular events during editor mode already: https://docs.unity3d.com/ScriptReference/ExecuteInEditMode.html
A trivial way then would be to apply this to a special class/object which regularly "finds" all objects from the game object hierarchy. Then it shall filter that list for the ones you want to snap to the axis and enforce their Y.

Cannot Animate Interactable Gameobject using Mixed Reality Toolkit

I am a bit of a novice with the Unity Engine and Mixed Reality App development so please bear with me.
I have been working with the Microsoft Mixed Reality Toolkit for Unity to try and animate a game object and move it to the side. A simple action, very similar to an example scene provided by Microsoft with the toolkit called "InteractableObject" (Information links provided below)
Interactable Object - Mixed Reality (Microsoft Docs)
Mixed Reality Toolkit-Unity Interactable Objects and Receivers (Github)
This example scene in Unity has multiple objects to be used as "buttons". With the Mixed Reality Toolkit, even objects that you want the user to interact with to perform some sort of action when selected is even considered a button. At least according to the documentation I have actually been able to find on the subject. This is a series of screenshots depicting the inspector panels for my GameObject and the container for my object:
GameObject Inspector Panel
GameObject Container Inspector Panel (Part 1
GameObject Container Inspector Panel (Part 2
I am trying to make a single game object move to the side when I place the standard cursor on it. This same action is done with a balloon object in the example scene I mentioned. I have created the animator and the state machine the same as they did in there example as well as setup my game object in an almost identical format. Only real difference is that created a balloon object themselves and I am using a different set of custom models from my company.
When I attempt to play back the app in the Unity Editor, the state does not change when I place the cursor on the object. I can force the state to change using the editor and the required animation engages, but it will not change the state on its own. I configured my state machine the same as the Microsoft example and setup my state variable the same as well. It should move from an "Observation" state to a "Targeted" or "ObservationTargeted" state when the cursor moves onto the object. A screenshot of the GameObject state machine and the inspector panel of the specific transition in question are provided below:
GameObject Animator State Machine Setup
Observation to ObservationTargeted Transition Inspector Panel
I went through and verified that all components added by the Mixed Reality Toolkit are the same and they are. This includes the DefaultCursor, InputManager, MixedRealityCameraParent and Directional Light. I also checked that all the scripts were coded the same as well and they are. I am running out of places to look. I attached the Visual Studio debugger to the project in Unity and have verified that it just isn't changing the state on its own. But I cannot figure out why. I believe the problem has something to do with the setup of the transition, but I haven't been able to find the issue. All of the other mentioned components are provided by Microsoft and are not changed by myself nor are they changed in the sample scene.
If anyone else has had a similar problem or may know where I can look to find the problem please let me know. I haven't even built the project into an UWP application yet.
I know it's been a few months, but do you still looking for the solution?
With the newest version of Mixed Reality Toolkit you could make any GameObject to act as a button. Simply read this documentation. I have some cubes as buttons in my Unity project and the only extra Component I added to it to make it work was Interactable, which comes from Mixed Reality Toolkit.
If you want to trigger some animation when you place the cursor on the object (or look at it if you're going to use it with Hololens) then you can add them in Interactable object by adding a new Event (for example: OnFocus() event)
Hope this helps is any way

How to update runtime scene via the editor

Is it possible to update the' position/rotation of an object in a running game by setting its properties in the editor. In other words, when I change something in Unreal editor I'd like to see it change immediately in a running instance of the game.
Yes, it is possible. Steps to do so (tested in 3rd person template, UE 1.17)
Play in editor
Hit Shift + F1 to show mouse cursor and unlock from viewport
Click on Eject button (it is on upper toolbar where Compile, Play and Launch buttons are.
Click on mesh on scene and edit it's properties
Hit Posses button (now instead of Eject)
Play in modified world
Be aware that editor will show some warnings if you move Mesh with Static Mobility. Also, shadows could be off (especially if you are using pre-built lighting).
EDIT: there is another procedure: instead of PIE, you can start Simulate (Alt + S). Then you don't need to do Unposses / Posses actions, just edit properties. There is a catch - your game needs to be playable in Simulate mode. From my experience, due to various reasons I couldn't run one of my game in Simulate, so I had to repeat that 6 steps I mentioned earlier.

UE4 Enabling Mouse During Play?

I'm extremely new to UE, and doing a few easy tutorials to get started, so I don't exactly know the correct terminology to use to help me find what I am looking for... Anyway, whenever I hit play and the game starts, my mouse disappears and I am only able to use the input that I set up; so my question is, even though I do not need mouse input for movement, as I am using WASD, how do I keep my mouse unlocked and available to move around without being locked to the camera?
When you hit play and the game starts, your mouse gets captured by the game to control the camera. If your play button is set to play in the viewport, you can release the mouse from the viewport by pressing Shift-F1. The game will still be running, but input (including from the keyboard) will be suspended and you can interact with the editor.
You can also change the default behavior of how the mouse is captured and it if is constrained to the viewport boundaries. To see these options, go into the project settings (settings button above main viewport/project settings...). On the left side of the project settings window, select 'Input' under the Engine heading. On the right side will be some mouse preferences that can change its behavior.
For instance, to allow the mouse to travel outside the viewport, change 'Default Viewport Mouse Lock Mode' to 'Do Not Lock'. I don't recommend this, but you might experiment with these to get a feel for what they do. Also, you might look up these settings in the Unreal documentation for more detail.
There are 3 blueprint nodes that change the input method:
Set Input Mode Game
Set Input Mode Game and UI
Set Input Mode UI
You want a combination of the second one and a "Show Mouse Cursor" node. However, if you are making an FPS and you use the mouse to look around, you may lose that ability with the second node above. It comes down to what your game is and how you want to use the mouse.
I had the similar issue. So I did something like this in Level Blueprints to achieve what I want.