Finished the RPG course! Looking forward to part 2. Here's what I got so far

Thanks Ben and Rick for giving me the tools and knowledge to get where I am now, definitely looking forward to part 2 of this RPG course. Here’s the current state of my game. Still have much to do with the core aspects of the game, but I’m proud of my level design thus far.

6 Likes

fantastic work… thats some nice level set dressing there.
Your house and fence assets, what asset is that or you made them yourself?

2 Likes

Thank you!! The houses, fences and most of the other assets you see came with this package. There’s a lot more I haven’t used that comes with this package, it’s a bit pricey but i’d say you get your money’s worth. Especially for someone like me who doesn’t know how to make these 3D models yet.
https://assetstore.unity.com/packages/3d/environments/fantasy/village-exteriors-kit-38045

Just curious, whats the file size of your project now with all the imported assets? I find I keep picking up assets here and there and before I know it, I have an 8GIG project file, thus periodic back up on my NAS server for that one project folder can take ages.

I know what you mean, my project file is 21GB now. I still have a bunch of cleaning up to do that I haven’t done yet so I expect it to go down but not by much…

another thing I noticed as you move your player… you are able to rotate the camera (which I can only assume is) by clicking on the right mouse button? if you keep rotating, does your mouse eventually move to the edge / out of your game window?

I use my middle mouse button to rotate due to my special ability being my right mouse button. When rotating my mouse will stop within the game window, unless I’m using 2 monitors then my mouse will roll over to my second monitor. But I like the idea of having my cursor stop at a fixed point while rotating. Here’s the script I’m using for my camera/rotation if you’re interested. If you see any flaws in my script or find a better method let me know! Feel free to use it :slight_smile:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MMOCharacterController : MonoBehaviour {

//Trasforms
public Transform playerCam, character, centerPoint;

//character controller declaration
CharacterController player;

//Mouse Rotation
private float rotX, rotY;

//Mouse Y Poxsition
public float mouseYPosition = 1f;

//Mouse Sensitivity
public float Sensitivity = 10f;

//Mouse Zoom
private float zoom;
public float zoomSpeed = 2;

//Clamping Zoom
public float zoomMin = -2f;
public float zoomMax = -10f;

public float rotationSpeed = 5f;

//Move Front Back left & Right
private float moveFB, moveLR;

//Movement Speed
public float Speed = 2f;

//Velocity of Gravity
public float verticalVelocity;

// Use this for initialization
void Start()
{
    //character controller
    player = GameObject.Find("Player").GetComponent<CharacterController>();

    //mouse zoom
    zoom = -3;

}

// Update is called once per frame

void Update()
{

    //Mouse Zoom Input
    zoom += Input.GetAxis("Mouse ScrollWheel") * zoomSpeed;
    if (zoom > zoomMin)
        zoom = zoomMin;
    if (zoom < zoomMax)
        zoom = zoomMax;

    //Mouse Camera Input
    playerCam.transform.localPosition = new Vector3(0, 0, zoom);

    //Mouse Rotation
    if (Input.GetMouseButton(2))
    {
        rotX += Input.GetAxis("Mouse X") * Sensitivity;
        rotY -= Input.GetAxis("Mouse Y") * Sensitivity;

    }

    //Clamp Camera
    rotY = Mathf.Clamp(rotY, -60f, 60f);
    playerCam.LookAt(centerPoint);
    centerPoint.localRotation = Quaternion.Euler(rotY, rotX, 0);

    //Movement Speed
    moveFB = Input.GetAxis("Vertical") * Speed;
    moveLR = Input.GetAxis("Horizontal") * Speed;

    //Movement Direction
    Vector3 movement = new Vector3(moveLR, verticalVelocity, moveFB);

    //Movement Rotation
    movement = character.rotation * movement;

    centerPoint.position = new Vector3(character.position.x, character.position.y + mouseYPosition, character.position.z);



    //** Note, go into Edit -> Project settings -> Input and ADD 'Jump" ass 'space" **
    //check if player is on the ground

}

// FixedUpdate is called once every other frame

}

I myself am using Cursor.Lockstate to keep the cursor in place.

            if (Input.GetMouseButton(1))
            {
                Cursor.lockState = CursorLockMode.Locked;

                // rotation code
            }
            else
            {

                Cursor.lockState = CursorLockMode.None;
            }
     

This makes the cursor disappear on mouse right click and you can rotate camera as you please, upon letting go of the button cursor will reappear. This is the behaviour the cursor has on games like Guild Wars 2, World of Warcraft and many other mmorpgs I believe.

Only problem so far with this code is, on right click, cursor will immediately jump to the center of the screen and reappear from the center of the screen ( and not from the exact position you clicked on screen)… so its not all that perfect.

check at around 4 seconds into the video here (https://www.youtube.com/watch?v=xWlB_kq5x5g)

There’s ways to fix this from posts on unity gamedev forums, but I failed in my attempt to fix this issue so I currently have this bug on hold while I move on with the course.

Don’t know if you stumbled on this thread but I found a link where someone else was having a similar issue. There’s a mouse rotation script in the discussion that they said worked for them.

didn’t come across this solution before. I will have a look and see if it works for me.
Thanks.

Looking really nice. Can’t wait to see more!

Privacy & Terms