0
Answered

Change Camera/Controls Mobile

Nate 6 months ago in Game Creator updated by eagleeyez 5 months ago 4

Sorry for the double post, accidentally hist submit before writing my text.

I have Game Creator and the Shooter Module.

I'm trying to get something to work. I'm building a top-down game for mobile that also changes to FPS when using a sniper rifle crosshair. However, I'm using an orthographic main camera in order to create my isometric top-down look, which means when I switch to FPS motor it looks all wonky because the main camera isn't a perspective camera. So if possible, I'd like to know how to do a few things:

  1. Main camera is orthographic. Top-down motor is the starting camera. When I switch to the FPS motor with the switch camera action, the orthographic camera is wonky. However, if I set the FPS motor to "set camera properties", and change it to perspective when FPS motor is on, then the camera change doesn't work at all. It seems that going from orthographic to perspective during runtime seems to cause an issue. So I'd like to either be able to change from ortho to perspective if possible, and I'd also like to know how to change which camera is my "main camera". Can I have a camera set as the FPS main camera and another for the top-down one, with their camera motors connected respectively, that I switch between when aiming my sniper rifle/crosshairs.
  2. How do I disable player movement/input during runtime? I'd like to disable walking controls when the player is zoomed in.
  3. Is it possible to change the mobile touch joystick to affect the rotation rather than the position of the player? When scoped in and in FPS mode, I want to set the mobile joystick to control where the player is aiming, rather than moving the character/walking. And I also want to disable the rest of the screen from controlling where the player is aiming like it normally does on mobile since now the joystick is taking over.
  4. Can I independently set the position of a weapon when at ease vs when aiming. I'm using the ease state as essentially a holster state, since I only have one weapon at a time and I want the model to be visible all the time. However, when using the sniper rifle, I've set the position to look good while aiming, but when at ease the player just holds the rifle with one hand and swings it around while running, which looks odd and makes the barrel clip through the player/floor. So when the player is holding a weapon at ease like the sniper rifle, I want it to appear on his back or other position, separate from where it is while aiming.
  5. When a run the holster weapon action, the animation runs very slow (takes 3-4 seconds to compete) however when playing the actual animation file it's clear that it only lasts about a second. Any reason why this animation might be happening so slowly? Anyway to change the speed of the holster animation at runtime similar to other gestures like waving?
  6. When using the tween camera, what's the best way to set up a long shot that goes in multiple directions? As in, tell the camera to go from position A to B to C to D to E. I'd imagine one way would be to setup multiple tween cameras going A to B, B to C, C to D, D to E, but I'd like to know if there's a better/faster way to quickly animate a longer cutscene.
  7. Anyway to control post processing effects during runtime? For instance, changing the focus distance for the depth of field during a tween camera animation.

Sorry for the wall of text, but these are some issues I've run into and I'm sure there's probably a simple way to fixing them that I just haven't noticed. Really great product so far, very happy with the purchase!

Unity version:
2019.2.17f1
Game Creator version:
1.1.2

Answer

Answer
Answered

Holy molly. Okay, for next time, please use a separate topic for each question, as this doesn't really help other users who search if a question has been answered looking at the title.

Main camera is orthographic. Top-down motor is the starting camera. When I switch to the FPS motor with the switch camera action, the orthographic camera is wonky. However, if I set the FPS motor to "set camera properties", and change it to perspective when FPS motor is on, then the camera change doesn't work at all. It seems that going from orthographic to perspective during runtime seems to cause an issue. So I'd like to either be able to change from ortho to perspective if possible, and I'd also like to know how to change which camera is my "main camera". Can I have a camera set as the FPS main camera and another for the top-down one, with their camera motors connected respectively, that I switch between when aiming my sniper rifle/crosshairs.

I've tested this and seems to work fine. Can you make a video capture showcasing the issue? Seems strange, since as you mention, tweaking the "Change Properties" in each camera motor should switch between perspective and orthographic.

How do I disable player movement/input during runtime? I'd like to disable walking controls when the player is zoomed in.


Both disabling the character movement and walk/run states is done in the Character Property Action. Setting the Player's IsControllable into false will block any input by the user.


Is it possible to change the mobile touch joystick to affect the rotation rather than the position of the player? When scoped in and in FPS mode, I want to set the mobile joystick to control where the player is aiming, rather than moving the character/walking. And I also want to disable the rest of the screen from controlling where the player is aiming like it normally does on mobile since now the joystick is taking over.

Not at the moment. The rotation of the camera is handled by a free-form movement of the finger on the right side. However, there's a third-party module that allows this out of the box called Accessibility. Might interest you.

Can I independently set the position of a weapon when at ease vs when aiming. I'm using the ease state as essentially a holster state, since I only have one weapon at a time and I want the model to be visible all the time. However, when using the sniper rifle, I've set the position to look good while aiming, but when at ease the player just holds the rifle with one hand and swings it around while running, which looks odd and makes the barrel clip through the player/floor. So when the player is holding a weapon at ease like the sniper rifle, I want it to appear on his back or other position, separate from where it is while aiming.

There's currently no way of doing this. However, we're opening a ticket to add an "On Start Aiming" and "On Stop Aiming". With this, you can change the attachment (weapon) of the character to a different body part (from hand to back, and vice versa).

When a run the holster weapon action, the animation runs very slow (takes 3-4 seconds to compete) however when playing the actual animation file it's clear that it only lasts about a second. Any reason why this animation might be happening so slowly? Anyway to change the speed of the holster animation at runtime similar to other gestures like waving?


Yes, it's a bug, but should have been fixed in the latest version. Make sure to update both Game Creator and the Shooter module to the latest version (and install the update through the Module Manager!)

When using the tween camera, what's the best way to set up a long shot that goes in multiple directions? As in, tell the camera to go from position A to B to C to D to E. I'd imagine one way would be to setup multiple tween cameras going A to B, B to C, C to D, D to E, but I'd like to know if there's a better/faster way to quickly animate a longer cutscene.

The best way is setting up multiple cameras. It's cumbersome to set up, but it's a breeze to later tweak different parameters to adjust that perfect camera shot. You can also may be interested in using Unity's Timeline, which is specifically designed for cutscenes. However, depending on what you may want to do, may be overkill.

Anyway to control post processing effects during runtime? For instance, changing the focus distance for the depth of field during a tween camera animation.

Not at the moment. Post Processing doesn't come builtin in Unity, so we can't create specific code for it. Otherwise it would throw a bunch of errors. However, take a look at the Unity Hub. There might be an Action made by community members that deals with post processing.


While using a top-down camera, is there an easy way to make walls transparent when they block the player from view (diablo style). This way there is never a wall or object covering the player. So for instance, if the player when into a building where the roof was in view/in between the camera and the player, then the roof of the building would go to like 10% opacity so you can see everything inside of the building including the player. However I don't want to disable the object entirely because I still want it to cast shadows, so maybe a shader of some kind? Not sure if this is possible with the current triggers/actions/conditions.

Game Creator is for creating interactions. This issue is more related to a shader and we try to avoid dealing with these, since every game uses its own set of shaders and we want to be graphics-agnostic.

However, there are plenty of tutorials on youtube that deal with this. In particular, I believe there's a video from Sykoo that shows how to do this using the new URP and with zero code.

Best

Also another question I thought of:

While using a top-down camera, is there an easy way to make walls transparent when they block the player from view (diablo style). This way there is never a wall or object covering the player. So for instance, if the player when into a building where the roof was in view/in between the camera and the player, then the roof of the building would go to like 10% opacity so you can see everything inside of the building including the player. However I don't want to disable the object entirely because I still want it to cast shadows, so maybe a shader of some kind? Not sure if this is possible with the current triggers/actions/conditions.

Thanks again!

Answer
Answered

Holy molly. Okay, for next time, please use a separate topic for each question, as this doesn't really help other users who search if a question has been answered looking at the title.

Main camera is orthographic. Top-down motor is the starting camera. When I switch to the FPS motor with the switch camera action, the orthographic camera is wonky. However, if I set the FPS motor to "set camera properties", and change it to perspective when FPS motor is on, then the camera change doesn't work at all. It seems that going from orthographic to perspective during runtime seems to cause an issue. So I'd like to either be able to change from ortho to perspective if possible, and I'd also like to know how to change which camera is my "main camera". Can I have a camera set as the FPS main camera and another for the top-down one, with their camera motors connected respectively, that I switch between when aiming my sniper rifle/crosshairs.

I've tested this and seems to work fine. Can you make a video capture showcasing the issue? Seems strange, since as you mention, tweaking the "Change Properties" in each camera motor should switch between perspective and orthographic.

How do I disable player movement/input during runtime? I'd like to disable walking controls when the player is zoomed in.


Both disabling the character movement and walk/run states is done in the Character Property Action. Setting the Player's IsControllable into false will block any input by the user.


Is it possible to change the mobile touch joystick to affect the rotation rather than the position of the player? When scoped in and in FPS mode, I want to set the mobile joystick to control where the player is aiming, rather than moving the character/walking. And I also want to disable the rest of the screen from controlling where the player is aiming like it normally does on mobile since now the joystick is taking over.

Not at the moment. The rotation of the camera is handled by a free-form movement of the finger on the right side. However, there's a third-party module that allows this out of the box called Accessibility. Might interest you.

Can I independently set the position of a weapon when at ease vs when aiming. I'm using the ease state as essentially a holster state, since I only have one weapon at a time and I want the model to be visible all the time. However, when using the sniper rifle, I've set the position to look good while aiming, but when at ease the player just holds the rifle with one hand and swings it around while running, which looks odd and makes the barrel clip through the player/floor. So when the player is holding a weapon at ease like the sniper rifle, I want it to appear on his back or other position, separate from where it is while aiming.

There's currently no way of doing this. However, we're opening a ticket to add an "On Start Aiming" and "On Stop Aiming". With this, you can change the attachment (weapon) of the character to a different body part (from hand to back, and vice versa).

When a run the holster weapon action, the animation runs very slow (takes 3-4 seconds to compete) however when playing the actual animation file it's clear that it only lasts about a second. Any reason why this animation might be happening so slowly? Anyway to change the speed of the holster animation at runtime similar to other gestures like waving?


Yes, it's a bug, but should have been fixed in the latest version. Make sure to update both Game Creator and the Shooter module to the latest version (and install the update through the Module Manager!)

When using the tween camera, what's the best way to set up a long shot that goes in multiple directions? As in, tell the camera to go from position A to B to C to D to E. I'd imagine one way would be to setup multiple tween cameras going A to B, B to C, C to D, D to E, but I'd like to know if there's a better/faster way to quickly animate a longer cutscene.

The best way is setting up multiple cameras. It's cumbersome to set up, but it's a breeze to later tweak different parameters to adjust that perfect camera shot. You can also may be interested in using Unity's Timeline, which is specifically designed for cutscenes. However, depending on what you may want to do, may be overkill.

Anyway to control post processing effects during runtime? For instance, changing the focus distance for the depth of field during a tween camera animation.

Not at the moment. Post Processing doesn't come builtin in Unity, so we can't create specific code for it. Otherwise it would throw a bunch of errors. However, take a look at the Unity Hub. There might be an Action made by community members that deals with post processing.


While using a top-down camera, is there an easy way to make walls transparent when they block the player from view (diablo style). This way there is never a wall or object covering the player. So for instance, if the player when into a building where the roof was in view/in between the camera and the player, then the roof of the building would go to like 10% opacity so you can see everything inside of the building including the player. However I don't want to disable the object entirely because I still want it to cast shadows, so maybe a shader of some kind? Not sure if this is possible with the current triggers/actions/conditions.

Game Creator is for creating interactions. This issue is more related to a shader and we try to avoid dealing with these, since every game uses its own set of shaders and we want to be graphics-agnostic.

However, there are plenty of tutorials on youtube that deal with this. In particular, I believe there's a video from Sykoo that shows how to do this using the new URP and with zero code.

Best

Thank you so much for getting back to me! I really appreciate the time you took to answer my questions.

Referencing question 1, I ended up fixing/going around this issue by using a Perspective camera with a very low FOV (8-12) to imitate the Orthographic look but still have the functionality of perspective, especially when switching to FPS mode (and changing the FOV to a normal 60+).

In reference to the question about the holster animation moving slowly, I'll definitely update everything on my side, thanks. I also noticed that when I switch to my gun and spam shoot a lot, or really do anything a lot like spamming jump for 10-15 seconds, that sometimes the animation will just get stuck in a state (like legs not moving when running, or the running animation playing forever even when the player stops moving.) Basically seems like the animation just gets stuck and then can't reset itself. But if this is fixed with the newest update then ignore this! Just wanted to give you a heads up in case this is something new or I was doing something wrong.

Thanks again! Love the product.

+1

Dito, Holy Molly Nate! The answers you got just go to show how dedicated the GC-Team really are.

But also I say please post one question after each other in its respective topic so we can all just easily search it.

But it did actually answer some of my questions.