- Home /
late response mobile joystick crossPlatformInput
i have project 2D game side scroll for android mobile, firstly im using WASD button to move the character because the main gameplay is to avoid every enemy until finish, and yeah everything is good so far.
then i starting to change my WASD to mobilsinglestickcontrol from standard assets. so far so good on setting prefabs and script until i found something weird joystick response when i starting test it. detail is:
when using WASD button, my char move directly to whatever button i pressed (fast response). but using joystick, my char has delay or late to move to direction where i drag the joystick.
lets say he move to left then directly i change move to right. but my char do is: he move to left smoothly to top speed or myCharSpeed; then do brake speed until 0 then move to right smoothly to top speed again. like he float on moon or galaxy or whatever low gravity something like that. i dont need that smooth transition for my style gameplay project, fast response needed because enemy move fast to, to giving challenger. when joystick responsive to slow to evade transition, even pro game tester never move more than 2 meter or less.
please, can anyone give me clue how to fix that. thx b4 :D
Answer by 4ndik4w · Apr 16, 2017 at 08:46 AM
finally i found it. day after day i do research (sound like scientist XD) on myCharScript. yeah sory everyone i forget to include script preview (my bad XD).
i found that make my char move like floating in space is .addForce. but until now i dont know what exactly .addForce work and when to using that (u got me, im not an programmer when im starting learn unity3D).
but..... yeah, do little change (okay, exactly is my real hard work on 8 days and almost lost my spirit T_T) from myCharRB.addForce to transform.Translate and my char move like what i want.
thats all from me..... if this usefull for anyone stuck like me. then reference to it, maybe u got idea after read this. thanks and got a nice day ^_^
fixing problems will make you a better programmer from experience.
addForce
is realistic physic force simulation so in real world you cant immediately turn right from left.transform.Translate
is god choice to move objects but you will face a none collision detection at high speed from experience. so i advice using Rigidbody.velocity if 3d and Rigidbody2D.velocity if 2d.
Your answer
Follow this Question
Related Questions
2D shooting with mobile joystick 1 Answer
Make gameObject face position of Joystick [Mobile] 4 Answers
How do I do a double Floating joystick? (Direction and movement (one for each))? 0 Answers
Unity 5 Character Controller Mobile Input 0 Answers
Rotate GameObject Z axis only relative to Joystick 0 Answers