- Home /
Editing Character Motor
Hey guys, im trying to edit the character motor so my character can only move on the X axis.
im creating a side scroller and i want to use the original charactermotor but for the life of me i cannot work out how to edit the script in such a way that it stops movement one way but not the other. does anyone have any ideas or suggestions?
what should i be looking for? has anyone rebuilt the script for a side scroller?
Dave
Do you use a rigidbody? If so, just constrain movement along the y and z axes.
No I don't, I just use the character motor and platform controller scrips. When I add a rigid body my player just constantly jumps and shoots up when I constrain certain movements. Any suggestions?
HOLY CRAP! it works. thankyou thankyou thankyou. so simple.
Answer by robertbu · Mar 18, 2013 at 11:13 PM
I need to understand a bit more about your desired behaviors. I took a quick look at both scripts. As a starting point, modify line 15 in the PlatformController script to be as follows:
var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, 0);
Give me feedback on how this does or does not meet your needs.
Answer by davidc · Mar 19, 2013 at 12:29 AM
HOLY CRAP! it works. thankyou thankyou thankyou. so simple.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094028im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D Sidescroller: Change camera position? 1 Answer
Fall damage 1 Answer
CharacterController or Collider/Rigidbody 2 Answers
How do i keep the box collider from rotating? 1 Answer
I only want my character to jump when touching the ground 4 Answers