![]() I cannot find a way to only inherit the position, but any help I will greatly appreciate. I think that the biggest cause of this issue is the setting the character as a parent of the platform. Unity 2.5D Character Control in Platform Side-scrolling Game: This tutorial demonstrates how to use the visual editor of Unity program, and basic guideline scripting with C language on MonoDevelop, animator basics, the basics of movement character contorl and rotating to flip direction of game object. Many times when my character jumps on top of my platform, the character is pushed off of the platform on the x axis The moving platform has a RigidBody component, in case this may be the cause of this issue However, upon jumping off of the platform, the player looks sometimes like this: The scale is set to move between two invisible points, and when the player jumps on top of the platform, the player is set as a child of the platform. This works, but I feel this is not the best solution for this problem. I am unaware of the issue of this, but a temporary solution I found was to put transform.SetPositionAndRotation(transform.position, Quaternion.identity) in my Update method for my Player script. However, when I begin to move left and right, the character begins to spin via the rotation aspect on the transform component. Now, I control my character on the horizontal input. Private void OnTriggerExit(Collider other) Private void OnTriggerEnter(Collider other) If (transform.position = _targetB.position)Įlse if (transform.position = _targetA.position) Transform.position = Vector3.MoveTowards(transform.position, _targetA.position, _speed * ltaTime) Transform.position = Vector3.MoveTowards(transform.position, _targetB.position, _speed * ltaTime) Public class MovingPlatform : MonoBehaviour This is my code for the moving platform: using System Vector3 direction = new Vector3(horizontalInput, 0, 0) _uiManager = GameObject.Find("Canvas").GetComponent() ĭebug.LogError("The UI Manager is NULL!") įloat horizontalInput = Input.GetAxis("Horizontal") With the plane object selected in the Inspector set the scale to 5,5,5. Go to the Game Object main menu and select 3D Object plane. First, here is my code for the player: using System.Collections You should probably start with a new Unity project and call it something like ‘Simple Game Development’ (or similar). If that makes sense.However, with the character controller I have had several issues with both the Character Controller and the moving platform. ![]() I do t really want to have to use RotateAround either. I want to really understand how all this can work. I'm not asking for anyone to write me a script that handles all this I just want maybe a few good tips and hint maybe a few lines of example code. Say instead if rotating around camera when moving horizontal the player just moves right and left relative to camera. But I want this to be optional in script by toggling a Boolean?Īnd also another toggleable bool that makes movement normal. I just want him to continue moving and rotating around the direction he is moving while jumping.Īlso and maybe a dead zone before the camera follows say you have to move 2 units forward or back before the camera will begin to follow the player. In this gif is an example of what I don't want when jumping.Īs you can see when moving around the camera and then jumping he faces the cameras forward. Wether that be on the forward or while moving around the camera. When jumping I want the player to jump following the direction he is moving. I want the camera to always stay a set and constant distance from the player. A Unity 3D Platformer is a challenging project In this first episode, we will tackle building the foundation of our game by creating a Player Controller, harnessing the full power of the. When I move right/left on the horizontal axis(x) I want my player to rotate around an object for example the camera.īut then when I move forward/backward on the vertical axis(z) I want the player to move in the direction on the cameras forward. If that still doesnt work for you, write your own character controller, its not that hard. Basically you want a High Acceleration/High Deacceleration to get a tight feeling. ![]() Im trying to make a character controller like that in Super Mario 64 and lots more. Check out a recording of a Unity live training session by Matthew Schell that shows the process of setting up a custom character controller. I found that High Drag/High Force is a good system for tight feeling controls.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |