- Home /
I have an idea and I was wondering if it might be possible.
Hello. Is it possible to make a video game that has a 2D RPG look, but during a battle sequence the whole scene suddenly goes 3D and has a first-person and third-person perspective?
Thanks.
I'm not sure my opinion is acceptable or not.
On technical side, I can say yes, it's possible.
On game play side, I just can say it's depends on your game concept, your game type, etc...
Cheers! Vince
Answer by NorthStar79 · Dec 28, 2017 at 08:52 AM
Yes you can, i' ve allready did something similar before, its very long to explain in fact. but i will add an example for you to test it out.
first, you need to understand Layermasks, there are very good explanations out there, here check them out
then you can change your rendering layers from 2D to 3D (with some cool camera effects using Cinemachine)
thats all in fact,
but lets go deeper !
lets say we created two new layers like this :
then lets create a player with both 2d and 3d graphics and separate them with layers like this one:
than go ahead and crete 2 new virtual cameras using cinemachine and set them up. here some tutorials for it
and let's create a script for changing perspective and virtual cameras with code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class switchPerpectives : MonoBehaviour {
public CinemachineVirtualCamera TwoDCam,ThreeDCam;
private LayerMask currentLayermask;
private int currentPerspective = 3;
public Camera mainCam;
void Start () {
currentLayermask = LayerMask.NameToLayer("Default");
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.Space))
{
if(currentPerspective == 3)
{
currentPerspective = 2;
TwoDCam.Priority+=20;
mainCam.orthographic = true;
currentLayermask |= (1 << LayerMask.NameToLayer("2dGraphics"));
currentLayermask ^= (1 << LayerMask.NameToLayer("3dGraphics"));
currentLayermask |= (1 << LayerMask.NameToLayer("Default"));
mainCam.cullingMask = currentLayermask;
}
else if (currentPerspective == 2)
{
currentPerspective = 3;
TwoDCam.Priority-=20;
mainCam.orthographic = false;
currentLayermask ^= (1 << LayerMask.NameToLayer("2dGraphics"));
currentLayermask |= (1 << LayerMask.NameToLayer("3dGraphics"));
currentLayermask |= (1 << LayerMask.NameToLayer("Default"));
mainCam.cullingMask = currentLayermask;
}
}
}
}
thats all :)
here you can see how its works :)
And Finally, you can download this exapmle frome here :) good luck with your game.
PS: if this answer helps please mark it as correct answer, this way anyone who loking similar answer can easily find this.
Answer by Remy_Unity · Dec 28, 2017 at 08:19 AM
Short answer : YES.
Long answer : you can basically make any game you want, it only depends on the time you are ready to spend on it.