Swinging animation and mechanism in a game

hi i have been working on a game for exploration for some time now and have gotten my character to jump and walk aroundhttps://playcanvas.com/editor/project/917467 ,however i want to take it to the next level by adding a swinging mechanism,like spiderman.however,after only starting a week back,and have gone through tonnes of different videos i am stil confused.do you have any tips for someone who only started a week back?also he dosent need to swing from a certain thing just from the sky.also the controls for the game are wasd and space

Hi @anakin_Skywalker! I’m not sure what you mean with swinging. If you mean swinging on a rope, I have no idea how to achieve this. If you mean jumping around, you can do this with raycasts. In one of my own projects I created the abiltity to jump on walls. You can do a forward raycast from the player and if this raycast detect a wall, you stop the jump and keep the position. Sounds easy, but requires the necessary knowledge and time.

i think he means like a grappling hook, but more like spidermans web shooting mechanism

hi albertos,im not really sure what you mean by raycast but more of a grappling hook, like in the game just cause.

A raycast is basically an invisible grappling hook to detect if you hit an object or not.

https://developer.playcanvas.com/en/user-manual/physics/ray-casting/

https://developer.playcanvas.com/en/tutorials/simple-shape-raycasting/

You can make this invisible grappling hook visible by drawing a line from the start point to end point of your raycast.

https://developer.playcanvas.com/en/api/pc.Application.html#drawLine