Home > Blockchain >  How do I get my character to stick on walls
How do I get my character to stick on walls

Time:07-13

I'm fairly new to programming and am currently working on an 2D Android game using Unity. I want my character to jump to a wall when touching the screen but I don't know how I get him to stick to the wall.

CodePudding user response:

You could use the oncollisionenter or ontriggerenter method to know when you are in contact with a wall.
At that point it depends on how you created the movement and jump system: for example if you used rigidbody, you can set its property on iskinematic to true.
I'd write you some example code but I'm too tired and I'm on the phone: D.
If I have helped you you can thank me by marking this answer as accepted; I would be grateful :) For the methods and properties I mentioned, you can easily find explanations and tutorials online.

  • Related