Game Development Community

Possible ledge grabbing solution

by Ben Mathis · in Torque Game Engine · 06/11/2007 (4:29 am) · 6 replies

Ok, so we want to implement ledge grabbing in our engine. I've made a dts that has a ledge object, and a strategically arranged collision box.

Our thoughts for making it work. Place a mount node within the characters chest. If the mount node penetrates the collision box, mount her to the ledge and engage the ledge hang anim.

To do this though, we're facing a few hurdles, which is where we need the help of the Torque forum. :-)
1) How do we make a collision class that returns if it's been collided with, but does not actually stop the player from moving? Or is this even necessary? Should we just force mount her to the ledge if she collides with the box?
2) What file contains the code that controls the player position on screen? For the mounting.
3) How would you check if a mount node of the player penetrates a box? We don't want to use the entire character collision.

Also, as a bonus question, despite being all 3d, we want to constrain her to only travel in a 2d plane. (effectively a side scroller) Is there a way to do this other than just taking away the forwards backwards movement buttons? If she becomes un-aligned in any way to the plane of travel, it will break the entire level, so we'd prefer to not let her travel in the forward/backward plane in any way.

I understand these are probably very difficult questions that would involve a fair amount of time to address, so I really appreciate anyone's efforts to answer even a single point.

-Ben

#1
06/11/2007 (7:20 am)
Quote:1) How do we make a collision class that returns if it's been collided with, but does not actually stop the player from moving? Or is this even necessary? Should we just force mount her to the ledge if she collides with the box?
Items, by default, will call onCollision but not obstruct movement. The other alternative is to have no cllision mesh, but I'm not sure whether onCollision will still be called.

Quote:2) What file contains the code that controls the player position on screen? For the mounting.
player.cc
You may want to script the behaviour first, before digging into the source - scripts are more easily written and debugged, and don't require you to recompile.

Quote:3) How would you check if a mount node of the player penetrates a box? We don't want to use the entire character collision.
If I was doing this and wanted to do a minimal amount of engine coding, I'd mount another object to the Player's chest node. Then this object, when it collides, tells the Player that there's a ledge to grab.
#2
06/11/2007 (7:35 am)
Thanks Daniel.

I can already tell this will be an incredibly n00bish question, but how do you designate something as an Item, as apposed to something else? How does the engine know it's an item and not to block the player with the collision mesh, and when it's a collision mesh that should block the player? I couldn't find anything in the documentation. Is it just putting it in the item folder instead of the shapes folder?

Good idea with the object mounted on the player. Thanks for your answers!
#3
06/12/2007 (11:39 am)
A ledge grab maybe as simple as a trigger with collision difs. If you're using the dif object as a ledge you could put a collision dif under your avatar under the ledge (and behind her) say when they jump to the ledge to hold. The trigger could cause the avatar orientation and animation sequence change to make it seem as she was shuffling across the edge. This wouldn't work as well if you wanted that swinging motion (say tomb raider style) animation. Collision difs are invisible as well.

The other option is to make mount points across the ledge object (an object being a dts out of max since i don't believe you can mount to a dif) that match with the mount points on the hands. When the avatar moves left or right across the edge each mount is unmounted then mounted to the next. It would be similar to mounting weapons, except the weapon object doesn't move, that avatar does. Without sitting down to write the script and do testing I couldn't tell you how exactly to implement either option. But i'm sure you can search the mount option or trigger options in the tdn or other various documentation to find that sort of info. The mount option doesn't care as much about collisions, but you can always combine a dts with a dif if you don't want the chance the avatar could go through the wall. Dif's being those interior objects that are BSP brush models (created in quark or constructor).

There are really only 2 shapes in torque dts objects and difs, each having various flavors. All this should be able to be done in script theoretically.
#4
06/12/2007 (1:19 pm)
Quote:I can already tell this will be an incredibly n00bish question, but how do you designate something as an Item, as apposed to something else? How does the engine know it's an item and not to block the player with the collision mesh, and when it's a collision mesh that should block the player? I couldn't find anything in the documentation. Is it just putting it in the item folder instead of the shapes folder?
Don't worry about being a n00b, we all were once ;). Basically, when you creat any object, you are creating it as a certain class. This class might be Player (players), InteriorInstance (for .difs), StaticShape (for .dtss that are static), Vehicle (guess what it's for? ;)) or Item (for... items!). There are many, many more classes, and they each behave in different ways. So if you create an 'Item' object, the engine will know not to collide that object against Players.
#5
06/13/2007 (2:09 am)
Just brainstorming a bit... This is going to take a bit of work, but it will work for anything... ledges, pipes, ropes, etc...

Create a special brush entity called "ledge". Anything in your map that the player can "hang" from will use this brush. If the player is within range of the brush and presses the "grab" key, the player would "mount" the brush in a similar manner to a pathed interior (except using the hand mount points). The player could then be limited to travel along only "ledge" brushes until the "release" key was pressed. A "legde" brush would get one type of animation, a "rope" brush could get another, etc...
#6
06/13/2007 (4:54 am)
Just an idea but maybe the platforms players can ride on resource maybe helpful in someway?