- Home /
Too subjective and argumentative
Player Movement Help
No matter what I try I can't seem to get my player to move properly. I have tried coding using vector3 so that the player would move in the direction of the key that they pressed. The movement was jerky and uncomfortable and I would not want to use that for the entirety of the game. It also gave me a problem with jumping. I would go up and not come down, so I added a rigidbody to the player and it just fell over (I was using a capsule btw). I also tried adding forces to the rigidbody and it did the same exact thing. I just want a script that will allow the player to move around smoothly and jump properly, but nothing I am trying seems to be working.
How about using the CharacterController and the Character$$anonymous$$otor from the standard assets?
I won't learn that way. I understand that they're there, but again I want to learn how to do it myself. I'm also sure that those are coded in javascript, and I have no idea if that will have any impact on any of my other scripts because I am coding in C#.
-make a cube
-add colliders and rigidbody
-put the cube above the terrain so the colliders don't intersect
-hit play, if the cube doesn't fall trought but stays on the terrain, cool.
-now make a new c# script and drag it on the cube -inside Update make a trigger for jump, something like if(Input.$$anonymous$$eyCode($$anonymous$$eyCode.Space))
-now you can use Addforce()
-also you have to track if the player is already in the air, so you don't jump more than once before hitting the ground again, that is called a ground check
-to move you can use Translate(), it adds a vector(x,y,z) to position of the gameObjects transform every frame.
In general I would suggest that you don't try to implement the whole thing from scratch, but rather after creating these basics and learning how they work, grab the standard character controller and modify it to your needs.
Radivarig
In reply to the comment on this thread :
have no clue of why you closed the thread that I made. Nothing was wrong with it and I was really trying to get help since I am a pseudo-novice at program$$anonymous$$g. Please refrain from closing any of my future threads, as I would like to take as much help as I could get. "Too subjective and argumentative" is not really a reason why you should have closed the thread, and honestly most of the people who commented were helpful. Again, please refrain from doing this because I was asking for help, not you. Closing a thread prematurely like that will not solve my issue.*
From the question : I just want a script that will allow the player to move around smoothly and jump properly
I closed this because as it currently reads, you are asking for a controller script. If you had shown the script you were working on, that would've been a suitable question and people would've been able to expand and give advice on your code. But as you have not shown your current code, nor specified if you are using a character controller or a rigidbody, the question is vague, unspecific, and unanswerable.
There are a million resources out there on making a controller (I have linked just a few in my above comment, these were given to help you), so this is also a duplicate question.
As there is no 'one true way' of making a controller, it is impossible to give a singular answer, hence the reason 'Too subjective and argumentative'. Controllers are varied and built to suit the needs of the project.
I encourage you to keep learning; search, read and do many tutorials. Only then will you get a better understanding of coding.
However, when a question is unspecific, lacking in detail or appear as a 'write-my-code' questions, I shall continue to close them.
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Similar movement to a game (look description) 1 Answer
Moving a player with Rigidbody 2 Answers
Distribute terrain in zones 3 Answers
Scripting and Coding Dictionary 0 Answers