Game Development Community

Climbing ladders, ropes, walls, etc.

by Afrim Kacaj · in Torque Game Engine · 12/23/2005 (9:52 am) · 37 replies

I would like to implement ladders in my game so that I don't have to use stairs in towers. (If I used stairs my towers would have to be wider, which is what I don't want)
So I have seen a few dead threads dealing with this issue but none seem to have the answer. I was wondering if anyone has been able to implement climbing and how.

The issue is not how to detect stairs as that can be done with collision or a "Operate" key so that when pressed you do a line test to see if there is a ladder within reach.
The issue that I am having is how you get the player to move up/down. I have seen threads that suggest modifying the player's gravity, but that doesn't sound reasonable. In real live when you climb a ladder your gravity remains the same. Changing the players climbable surface angle makes more sense but when I set it to 90 I still can not walk up a ladder (unless I tilt the ladder slightly).

Anyways I would love to hear how you have implemented this.

Thanks,

Afrim
Page«First 1 2 Next»
#21
06/14/2006 (7:20 pm)
Do you have any C++ code for the changes in the engine. If so could you give a post a link please?
I have been trying to do the same thing with no success. Thanks
#22
06/14/2006 (8:16 pm)
I do, I will try to post soon. My plan was to just submit the files that i have changed and then people can use winmerge but I own the lighting pack so only those users would have access to it. Ill do a winmerge my self and only sumbit the changes as soon as i get a chance.
#23
09/11/2006 (12:17 pm)
Hi, the need for a ladder has come up in our project and any help you can give us would be greatly appreciated. I have already implemented the runSurfaceAngle hack in script but there are problems with that. Thanks.

Nick
#24
09/11/2006 (9:39 pm)
Here's what I would do. This requires significant amounts of C++:

1) Create ladder as a specific trigger. It can be vertical.
2) Tie the ladder to a path, with two nodes, "start" and "end".
3) When player hits the ladder, set a special mode in the player for "climbing" (similar to how it's "swimming" or "running").
4) Check whether player is closer to the top or bottom part of the ladder. If top, set "reverseClimbing".
5) In this special climbing mode, forward means in the direction from "start" to "end" nodes, or from "end" to "start" if "reverseClimbing" is set.
6) In this special climbing mode, the locomotion animation "climb" should be played instead of "run". Ideally, the "climb" animation is indexed by how far you've climbed, rather than time, so that you can avoid foot- and hand-sliding.
7) Each step when climbing, check whether the player is still colliding with the ladder. If 5 steps have elapsed without ladder contact, turn off "climbing". Also, if the player is at the very top (or very bottom, if reverseClimbing is on), then turn off "climbing".
#25
09/11/2006 (10:19 pm)
The best that I can do for you right now is send you my player.h and player.c files. There is no Lighting pack specific code in the two files so it shouldnt be a problem. I have made some other modifications to the files (added mele resource) but everything is commented so you should be able to figure out whats for climbing.

My implementation works pretty well but there is one problem that I havent had time to figure out yet. Getting on a ladder to climb up works perfectly. But once you get to the top, its pretty hard to get on the ladder again to climb down, your only other choice is to jump :) however I am starting to like the idea and I am considering it as a feature rather than a bug.
#26
09/11/2006 (11:55 pm)
Thanks for the tip hplus. I'll have to think about that, you have some good points.

Afrim, that would be really helpful! Check my profile for the address. I have a TLK license by the way. Maybe I can put a trigger on the top of the ladder and make some checks there to start the climbing down. But like you said, a jump would do unless it happens to be a really tall ladder. Thanks!

Nick
#27
09/12/2006 (8:16 am)
Afrim, You though about making this in resource because I to find myself needing a ladder. Thanks.
#28
10/30/2006 (8:55 am)
I made this into a resource now waiting for GG approval. Attached files are from torque 1.5, so I guess only 1.5 owners will be able to see it.

Sorry it took so long, good luck!
#29
10/30/2006 (11:27 am)
Thanks! Have you upload the files yet. Yes I have Torque 1.5.0
#30
10/30/2006 (2:19 pm)
I did upload the files but they have not approved it yet. Not sure how long it takes for the approval process.
#31
10/30/2006 (2:24 pm)
You can actually share the link to the Resource before it gets approved.
#32
10/30/2006 (2:34 pm)
Thanks for the resource Afrim!
#33
10/30/2006 (3:23 pm)
Looks like it has been approved, someone already posted a comment.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=11502
#34
10/30/2006 (4:28 pm)
Thanks very much.
#35
10/31/2006 (4:34 am)
Thanks Afrim - awesome work!
#36
11/02/2006 (6:29 pm)
Has anyone had issues with the player not actually climbing the ladder, all the console output is comming up, but the player seems to just be shaking at the bottom.

cheers.
#37
11/02/2006 (6:54 pm)
Andrew, I forgot to mention that the object you are trying to climb has to be slightly slanted. Because the climable surface is treated as a walkable surface, even though I added code there to override the max walk surface angle it still has trouble with 90 degree angle. Try to slant your ladder a bit, even 89 degrees should do it.

I will update the resource with this info.

Im glad you got that far at least.
Page«First 1 2 Next»