- Home /
Basic Movement on a Plane without Character Controller
Hello,
What I'm currently trying to do is create simple movement on a plane (with slopes). I would use the built-in character controllers, but it's movement is based off physics, which my game does not need. I just need a way for my character to keep in contact with the plane, while being able to move in eight directions. Any help is appreciated. :D
Thanks in advance!
I don't think the built int character controller uses physics(I think that's the point of it actually) While it is true that Simple$$anonymous$$ove automatically applies gravity and calculates your movement in meters/second, $$anonymous$$ove does not, it just keeps you from walking through stuff.
I can understand not needing physics, but Character Controller is way more than just that (See Skin Width, see Collision Flags).
If you don't $$anonymous$$d me asking, what is wrong with using it for your game, exactly?
Answer by Piflik · Jul 17, 2012 at 01:05 AM
Well then...transform.Translate(Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"))) for the eight direction. To keep the player on the plane, do a raycast and place the player on the intersection point with the plane (probably you need two raycasts, one straight down, one straight up)
it depends on what you want.. the raycast provides many overload methods so you can choose what you want to use based on your given data..
@Higgyfish: Don't post further questions as answer. I've converted your answer into a comment.
I still don't get why you don't want to use the CharacterController? don't get me wrong, i talk about the component, not about the FPS or TPC scripts that comes with the standard assets.
The character controller is a component to move an object without physics (it's not influenced by external forces), but you still have collisions which you usually want.
Feel free to edit your question to add some more details. Btw a plane is always flat. When your "level" has slopes / hills ... it's not a plane. For real plane-movement you don't need to worry about the height.
Answer by sam32x · Jul 17, 2012 at 03:44 AM
you could make trigger checkpoints and then make a script so whenever a car goes through the checkpoint a number goes up, and then when the player goes through the checkpoint sends the number to the car and then it gets displayed on the screen as the position, but you would have to make sure the checkpoint isn't touching anything else and you would need one every few seconds or the counter wouldn't update enough.
Your answer
Follow this Question
Related Questions
Character Attributes Question 1 Answer
Stick an object to the ground while moving? 1 Answer
How to add accelerometer controls to this script? 0 Answers
counting seconds that character is idle. 1 Answer
Third Person type Rpg movement 0 Answers