Third Person Game Foundation Kit [RELEASED]

-22 December 2021-

The 3D Aventure Game Kit is my latest asset. While it isn’t necessarily meant to replace this asset, it is similar and has a more focused approach on being an all-round game kit. So, if this asset does interest you, make sure to go and check that one out too as it may be more what you’re looking for compared to this asset.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Third Person Game Foundation Kit - Version 2.0
Check the store page out for demos and more information on the asset.

Hello there!

So I’ve been working for the past year on a 3D Zelda-style engine that is meant to emulate the mechanics and gameplay of the 3D Zelda games (mainly the N64 ones). Since the start, it has evolved to be a multi-purpose third person game foundation kit which borrows from the likes of Zelda and Mario titles. It is currently loaded with tonnes of features (Mario 64 jumps, slope sliding, NPCs, Inventory, HUD, ledge climbing, ledge grabbing, swimming… the list goes on).

I made this completely on my own and have made everything in it myself (no use of other people’s assets and nothing copied from any tutorials). I also taught myself Blender for this and did the animations myself (which as they stand now are just very amateur place-holders); also note that the animations are not mecanim animations, as I like to control movement with scripting.

Finally, here’s the latest video showcasing the asset:

Please leave a comment if you want to share your thoughts/interest.

5 Likes

hello. congrats for making this. 3 questions.

  1. you say “character moving around in 3D space, relative to the direction of the camera.”
    can the movement be made independent of the camera? (because making it dependent on camera I think is a bad decision)
  2. you say no mecanim, “just code in the script”
    does that mean that, it works for generic, and no transitions or there are transitions.
  3. you say “gamepads/controllers”
    how hard is to change the inputs to custom one, like controlfreak, is it one line, like input.getkey(x)
  1. What that means is that it basically moves in the space the camera is looking at; so that if you hold ‘up’ on the control stick, the character moves forward (away from the camera). This is the method most third person games go for as it’s very intuitive and makes the most sense to the player. The movement can be based on whatever you like, simply set the velocity to whichever direction that you would want the character to move in. And technically speaking, it’s not dependent on the camera itself, but an invisible transform that copies the camera’s rotation on the y-axis.

  2. By no mecanim I mean that the movement of the rigidbody is controlled by the script. The animations stay in place and don’t move the character, but rather the rigidbody is given a velocity and an animation plays in place of the rigidbody. Perhaps I used the wrong term, I just mean that the animations themselves don’t have their own speed/movement/positional changes. There is of course a animation controller with transitions and such to flow between the animations; it’s usually referred to as the ‘old’ way of handling animations in Unity.

  3. Yes, it’s like Input.GetButton(“Action Button”), and “Action Button” is defined in the Input Manager and can be changed to whatever you like.

I hope that answers your questions! :slight_smile:

ok, thanks for the answers. 2 is good (thats no root motion), 3 is probably good (see, controlfreak is a mobile controller and has nothing to do with inputmanager).

I didn’t see it anywhere, so I’d rather ask, if it works on android platform too.

about 1, what happens if you switch off or change the camera? theoretically if the camera transform is just a reference position, it also could be world.space, or a transform at 0,0,0 (?). would you try out if it works with multipurpose camera (in the sample assets)?

I’m leaning towards buying it, just want to be sure won’t run into walls.

I haven’t used controlfreak but the asset is basically two main scripts; the ‘Input.GetWhatever’s can be changed in the code to work with controlfreak (I’d assume). If it depends on any Axis’ or whatever, then those 'Input.GetAxis’s lines would have to change too. I’m not too knowledged on this third party asset but I can’t imagine why it wouldn’t co-operate.

There’s no reason why these scripts wouldn’t work on Android. Simply set up a control system with touch controls and assign the lines of input code to work with said touch controls. Like I said, it’s only a couple of scripts, really.

The relative transform that the character moves relative to can be anything, anywhere. I have basically made something that works well for a typical third person game; if you want to remove the camera then you would have to find a way for the relative transform to be controlled. I just tried it with the multipurpose camera standard asset and attached the CameraFollower.cs script that my asset uses to the ‘Main Camera’ child object of the multipurpose camera. It works fine aside from some floaty/bouncy issues when moving the camera freely; I imagine this is due to the script that the multipurpose camera uses conflicting with my camera follower script. I can’t imagine why you would need the script that the mulitpurpose camera asset comes with but… there you go, it works. I’d suggest just using the camera prefab that I have provided and any adjustments to the cameras movements can be made by you in the CameraFollower script provided.

because I have been using that for characters and vehicles and proved to be working pretty good. I was interesting how it behaves, because that has a rigidbody attached. also there are a couple camera systems on the store, so it’s probably not just me who would think about using another camera.
I’ve seen this approach you using for other third person controllers and already had problems with that. maybe I’m just over-anxious and would work just fine, but there are many other possible scenarios where movement tied to one camera seems to me like it doesn’t make sense (multiple cameras switching, different POV’s etc).

“a way for the relative transform to be controlled.” this worries me most. so it can’t be static? if it moves, the chances of issues like jerkiness occuring are much bigger. (I understand if you have it set up like that, but could you make a camera-free version, if possible?)

I want to add a couple things to the controller, like IK, shooter system, and so on. this looks like a good start, no need to worry, I’m just looking into it if it suits my needs.

The reason that the camera requires the CameraFollower script is because it is also controlled by the character (for when you target, focus on a target, move around in free mode and go first person). The relative transform can be static, all it has to do is rotate; by control I mean you would have to get it to rotate or whatever… I made it a separate transform so that the character isn’t bothered about the rotation of the camera in any other axis.

The asset is meant to work as a combination of the camera and the character simply because the two interact with each other. You could remove the camera script and then remove any connection to the camera in the character’s script if you like, but one of the main points of the asset is how the camera works. It also handles wall collisions very well which isn’t something I’ve seen much of.

I think you are over-complicating it and I may be saying the wrong things… It’s basically:
A relative transform uses the y-rotation of the camera > The character moves relative to this transforms right and forward vectors > The character can control the camera to move behind him/rotate around him/etc.

I’ve basically made something to start building a project on; in terms of incorporating it into an existing project with other camera scripts and what not, it’s really up to the user to make it work in that way. Even then, it shouldn’t be too hard to do; like I said it would just be removing any connection that the character script has with the camera (so remove all the targeting, focusing, first person stuff and make the relative transform that you want the character to move relative to). If you don’t want the character to move relative to anything then it’s just as simple as press right to go right.
The complexity of these scripts which I think makes them worth selling is mainly all the slope/incline handling, ledge climbing, target focusing, camera collision and things like that. Removing the camera script is do-able,and shouldn’t cause any problems if you make the adjustments I mentioned.

Just keep in mind that it’s a very good camera that I’ve programmed and you can adjust it in whatever way you’d like. You can add damping or something like that but… I don’t see what else the camera really needs.

OK, bought it.
after setting up a number of inputs in the input manager, I could run it. I don’t see any immediate issues*, it works alright.
but stripping the code down to the basics looks like a lot of work, maybe I’ll just rewrite the inputs to mobile and see how that’ll go.
I see the animations are generic, so those should be changed for my character(s).

one suggestion/request: I’d like the climbing/catching ledge to be input-based (not always automatic. or chooseable).

*I see one issue. here it doesn’t catch on
2218224--147670--3rdcClipboard01.jpg

1 Like

Thank you for purchasing the asset! I hope you make something great out of it. :slight_smile:
It should all work fine, but if any problems arise then let me know and I’ll try to help you out as best as I can. The animations are my own amateur work; the blender file is there for you to alter or change for your own if you wish!

For the ledge climbing to be mapped to a button input, just change wherever something like ‘holdTimer >= x’ is to ‘Input.GetButtonDown(“Whatever”)’. You can also get rid of the chunk of code that counts the ‘holdTimer’.

For that climbing issue: Do a search in the ThirdPersonController.cs script for “//Checks for a ledge to grab while falling”. The Physics.Linecast that checks for a grab-able ledge is only working for anything under the layer collision mask ‘whatIsGround’. Those blocks in particular are under the collision layer “Slopes”. Either change the layer mask to ‘WhatIsACollision’ or change the collision layer of the slopes to ‘Collisions’.
EDIT: Also, the gradient of the wall that the character will be against when grabbing a ledge cannot be to gradual as they either won’t grab or the raycast that checks for a grab-able ledge won’t reach the ledge. Make sure any ledge that you want to be grabbed is on either a vertical wall or at least a very steep one.

I personally have encountered three bugs and have fixed them in my own time. The bugs are:
-Grabbing while falling doesn’t always work,
-Positioning of character while grabbing beneath,
-And rolling off a ledge might cause the character to fall rapidly;

The first bug is solved by changing the ‘Grabbing While Falling movement’ section in the TPC.cs script to:

if (grabWhileFalling) {
            anim.SetTrigger ("grabbing");
            if (rb.velocity.x != 0f || rb.velocity.z != 0f)
                rb.velocity = new Vector3 (0f, rb.velocity.y, 0f);            //The character moves down until it's at the proper position for grabbing the ledge
            if (this.transform.position.y < (midPointLedge.y - capColHeight * 0.5f)) {
                rb.velocity = Vector3.zero;                                                //The character is stopped in place and is put into its 'grabbing' state
                grabBeneath = false;
                grabbing = true;
                grabWhileFalling = false;
            }else
                this.transform.position = new Vector3(this.transform.position.x, midPointLedge.y - (capColHeight*0.5f), this.transform.position.z);
        }

The second bug is fixed by changing this:

rayAgo.name = "RayA";
rayAgo.transform.parent = this.transform;

…to this:

rayAgo.name = "RayA";
rayAgo.transform.parent = this.transform;
rayAgo.transform.localPosition = Vector3.zero;

The third bug is by changing this:

if (isRolling && !onGround && !underWater) {                                                                                                                    //If the character is off the ground just slightly and is not jumping, they will carry on rolling
                if (!jumping && !isTargetJumping)  
                    onGround = true;
                else
                    isRolling = false;
            }

…to this:

if (isRolling && !onGround && !underWater) {                                                                                                                    //If the character is off the ground just slightly and is not jumping, they will carry on rolling
                if (!jumping && !isTargetJumping && Physics.Linecast(this.transform.position, this.transform.position - (Vector3.up * capColHeight * 0.55f), out rayDump, whatIsGround))  
                    onGround = true;
                else
                    isRolling = false;
            }

These bug fixes will be included in a version update which I will release soon. I’m working on the swimming mechanic so that will be included once I’ve finished working on it.

looks nice.

Been following this project for a while now. Thinking about buying it.

After playing the demo, here’s some thoughts:

Any reason the camera doesn’t aim up/down? It’s not a deal breaker for me as I can easily add that in myself. Just wanted to be sure that it wouldn’t break anything.

I also had a glitch where if I was on top of a pillar, and a went to climb down and grab the edge, sometimes the character would intersect with the pillar. Was the fix you posted above addressing this, or something else?

Anyways, looks like a pretty good bundle. Lots of features.

1 Like

I just didn’t implement it but I have just managed to make it possible and is now part of the next release; if you purchase the asset I can give you the newly added code. :slight_smile:

That was indeed the fix I posted. For some reason, I didn’t set the position of the ray cast that makes sure it positions correctly. I’d recommend adding in all those bug fixes and then let me know if it persists or if any other problems arise.

Thank you! There’s still many more features to come: FEATURES

Also, I can see that the screenshot you posted has the model with the wonky textures. I’ve had issues trying to upload the webplayer demo because Unity likes to mess around with directories.

I have updated the webplayer demo with all the bug fixes and the vertical free-camera movement.
TRY IT HERE

Great, just purchased yesterday.

Are you going to keep the upcoming features like combat & item management as separate scripts?
Some of those things that aren’t directly related to movement may conflict with some things that I’ve already implemented in my project.

I think I’m most looking forward to the swimming and climbing :slight_smile:

Anywho, I’ll try working this into my current project now that I’ve downloaded it. I’ll let you know if I run into any troubles.

1 Like

Glad to hear! Hope you’ll enjoy it!
By the way, if you guys could leave a good rating on the asset store page then I’d really appreciate it. :slight_smile:

I’ll probably have it all in the same script but I’ll keep it as neat and sectioned as possible so it’ll be easy to remove any unwanted features.

Swimming is almost done and climbing should be easy. :wink:

Sure, you know how to reach me!

Great, looking forward to it.

Just brought it into my project and it’s all working great so far. I replaced all the inputs with custom ones from this Input Manager and that’s working good.

It’d be nice if things like collision layer order weren’t hard-coded, and were able to be set in the inspector. Although I’m still able to pick layers for “What is Ground” and “What is slope” in the inspector… Maybe I’m missing something?

Anyways, I reorganized my layers a bit to accommodate that, and everything’s working good!

Now I’m going to try bringing in my own character model/animations and see how that works out.

1 Like

I’m glad to hear it’s all working well!

Umm… is the collision layer hard coded? I’m sure it can be moved around when clicking on ‘Add Layers’. Then just refer to the right numbers in the code and select which layers you want each layer mask to cover.

Have fun inserting your own character! Try to keep the model in size with the 2 unit high capsule collider otherwise the distances for some of the ray casts may have to be changed if the capsule collider size changes. I’m trying to make it more streamlined in the next version so that changing the collider size will have all the raycasts accommodate with it.

Hey dude, just want to thank you for the review you posted on the asset’s store page! :smile:

Also, I have implemented a MUCH better free camera; anyone interested in this code then please let me know and I’ll message it to you! :slight_smile:

Ah yeah, I was referring to having to go into the code and change the number of the layer (which is annoying if you want to download an update of the script, your settings get clobbered.)

I would have thought you’d be able to get the layer number from the whatIsGround LayerMask directly, but after looking it up, there doesn’t seem to be an easy way to do this which is odd. :eyes:

But ah well, I’m nit picking really.
It doesn’t affect me too much now because I have spots 9, 10, & 11 reserved for those layers.

That’s very good news. Make sure to accommodate radius too :slight_smile:

1 Like