I’m doing a 2d platformer with 2D toolkit.
The character is controlled with a standard character controller.
Please help me how to make a move by the platform.
If I make the platform parent to the player is buggy (flying from side to side.) Rigidbody attach impossible.
If i do:
transform.position =
new Vector3(Platform.transform.position.x,transform.position.y,0)
player twitches and can not walk on the platform.
If i use standart platform input controller he don’t work too.
What should I do?
P.s. Sorry for my bad English I’m not a native speaker.
First issue, you need to add the standard character controller to the player then attach as custom script that uses the standard character controller. This script will be you actual controller and will handle you Input for the keyboard of controller.
You will need this two lines of code. The first lets you use the 2D Toolkit animation stuff. The second gives you access to the std controller. (this is in C#)
[AddComponentMenu("2D Toolkit/Demo/tk2dDemoAnimController")]
[RequireComponent(typeof(CharacterController))]
this blogged helped me out a lot. http://walkerboystudio.com/html/unity_course_lab_4.html Part 4-13 is all controller setup.
Second issue, The twitching. I think this is an issue with Unity’s standard controller. It seems like any time the bounding box changes, isGrounded becomes false for a few update cycles. If your using 2D Toolkits Tile Editor, this is a HUGE issue, cause even though it looks like on solid bounding boxed the controller only see the collision of EACH tile. Im not sure why other people dont have this issue but it seems to happen with any bounding box even if they are not part of 2D Toolkit and /or are overlapping. Its any time the bounding box changes. My solution was to build a solid bounding box on an Empty GameObject then place it in the right location and move the object as a child of the tile map.
I hope this helps. If you need more help then the WalkerBrothers, check out the 3rd Person Platformer Starter Kit. You can modify that player controller to work 2D.