Grabbing a ledge of a platform, then climbing up it.
by Will O-Reagan · in Torque X Platformer Kit · 05/26/2010 (9:25 am) · 17 replies
Any ideas how this can be accomplished? I'm thinking of something along the lines of bionic commando, except not so choppy, and no mechanical arm
At this point, i guess it would be intelligent to also think about climbing horizontally too.
My first thought is that I'm going to need a "beam" platform, and make use of "ActorHitSealing" and create functions and properties based on "climbing".. Also, if they are climbing up a beam to stand on it, it will be one quick move which can't be interrupted..
Anyways... I guess this will only work with completely horizontal platforms, if I'm not mistaken. I tried putting climbable objects on a slant, and it seems to be a no go at this point.
Any ideas would be great, thanks.
At this point, i guess it would be intelligent to also think about climbing horizontally too.
My first thought is that I'm going to need a "beam" platform, and make use of "ActorHitSealing" and create functions and properties based on "climbing".. Also, if they are climbing up a beam to stand on it, it will be one quick move which can't be interrupted..
Anyways... I guess this will only work with completely horizontal platforms, if I'm not mistaken. I tried putting climbable objects on a slant, and it seems to be a no go at this point.
Any ideas would be great, thanks.
About the author
I have a degree in dramatic art, and literature, from UC Santa Barbara. I've worked for a few studios, also at Animax Ent in 2008, and some smaller studios. Currently studying Computer Science at CSU Channel Islands.
#2
05/28/2010 (3:12 am)
If I get a few requests, I'll make a resource for this, but heres what I ended up going with. As you can see, I'm clearly not kidding, I really wanted this actor to climb up a ledge.
#3
05/30/2010 (11:42 am)
That actually Looks Very cool. but earlier u said it doesn't work on a slant? why is that?
#4
Honestly the "latched state" feature I created also has a similar limitation, its literally just a vertical climb at this point. I also have not tested it on variable "beam" thickness. As I figured out this is really just about catching a beam, and climbing up to stand on it. All in all, the feature is relatively limited at this point.
05/30/2010 (12:03 pm)
Well specifically, I was talking about the "Ladder" or "Rope" climbing feature. I tried rotating the rope about 15% and the actor still climbed up it, but the animation didn't look right because the rope was slanted.Honestly the "latched state" feature I created also has a similar limitation, its literally just a vertical climb at this point. I also have not tested it on variable "beam" thickness. As I figured out this is really just about catching a beam, and climbing up to stand on it. All in all, the feature is relatively limited at this point.
#5
06/02/2010 (5:06 pm)
oh i see but none the less its better than anything I thought of recently lol
#6
I would also be very interested in the code that added that too.
06/04/2010 (7:04 am)
Will Would it be possible to see the code for the state and I also noticed in your video that you also added wall jumping.I would also be very interested in the code that added that too.
#7
06/04/2010 (8:42 am)
The wall jumping was actually really easy, but since I don't have a wall jumping animation yet, I can't really say it's done. I really don't know what it will look like when the character is jumping off a wall, but I'll post my code anyways, later tonight maybe.
#8
that would be awesome if you could post the code.
I noticed that you didn't have the animation but it still looked decent
06/04/2010 (5:19 pm)
Will,that would be awesome if you could post the code.
I noticed that you didn't have the animation but it still looked decent
#9
In ActorComponent._updatePhysics add this in the begining
06/04/2010 (11:18 pm)
Yup, I thought so too, I'll just post the Wall Jump code, since thats easiest.In ActorComponent._updatePhysics add this in the begining
_horizontalLock -= elapsed;
if (_horizontalLock > 0)
{
if (_lockedLeft)
{
_moveRight = false;
_moveLeft = true;
}
else if (_lockedRight)
{
_moveRight = true;
_moveLeft = false;
}
}and this at the end of ActorComponent._updatePhysics/*since we checked for a wall jump, suposedly in update physics, make sure we clear the values.*/ WallJumpActivated = false;in update Air Physics.. (this is very similar to the double jump code)
if (actor.WallJumpActivated)
{
actor._actor.Physics.VelocityY = -actor._jumpForce;
actor._actor.Physics.VelocityX = actor._jumpForce * .5f * actor.WallJumpDirection;// * actor.wa
actor.HorizontalLock = actor.WallJumpStrength;
if (actor.WallJumpDirection > 0)
{
actor.LockRight = true;
actor.LockLeft = false;
}
else
{
actor.LockRight = false;
actor.LockLeft = true;
}
FSM.Instance.SetState(actor._animationManager, "runJump");
actor._onGround = false;
actor._jump = false;
actor._jumpDown = false;
}new public and private values/// <summary>
/// Length of time in seconds actor will be "locked" when wall jumping. basically keeps actor from immediately changing direction, which would look odd.
/// </summary>
[TorqueXmlSchemaType(DefaultValue = ".25")]
public float WallJumpStrength
{
get { return _wallJumpStrength; }
set { _wallJumpStrength = value; }
}
public float WallJumpDirection
{
get { return _wallJumpDirection; }
set { _wallJumpDirection = value; }
}
/// <summary>
/// weather or not the actor has activated a wall jump
/// </summary>
public bool WallJumpActivated
{
get { return _wallJumpActivated; }
set { _wallJumpActivated = value; }
}
/// <summary>
/// how long is the horizontal lock, over 0.0 seconds will lock the movement.
/// </summary>
public float HorizontalLock
{
get { return _horizontalLock; }
set { _horizontalLock = value; }
}
/// <summary>
/// weather or not actor is horizontally locked IE: wall jump, horizontal lock so they can't turn around, and jump on same wall, or at least not to get higher.
/// </summary>
public bool LockLeft
{
get { return _lockedLeft; }
set { _lockedLeft = value; }
}
/// <summary>
/// weather or not actor is horizontally locked IE: wall jump, horizontal lock so they can't turn around, and jump on same wall, or at least not to get higher.
/// </summary>
public bool LockRight
{
get { return _lockedRight; }
set { _lockedRight = value; }
}
/// <summary>
/// weather or not actor is attempting a jump
/// </summary>
public bool Jumping
{
get { return _jump; }
set { _jump = value; }
}
protected bool _lockedLeft;
protected bool _lockedRight;
protected float _horizontalLock = 0.0f;
protected bool _wallJumpActivated = false;
protected float _wallJumpDirection = 1;
//a good value for _wallJumpStrength is .25f to .40f
protected float _wallJumpStrength = 0.0f;And in ActorHitWall (inside actorController), add thisif (!actor.OnGround)
{
if (actor.Jumping)
{
actor.WallJumpActivated = true;
if (info.Position.X < actor.SceneObject.Position.X)
actor.WallJumpDirection = 1;
else
actor.WallJumpDirection = -1;
}
}
#10
Tahnks for posting this code.. I can find all of the areas to add the code except for the ActorHitWall method what .cs file did you put this into?
I found the virtual method in the abstract class is that where you put this code?
06/05/2010 (4:20 pm)
Will,Tahnks for posting this code.. I can find all of the areas to add the code except for the ActorHitWall method what .cs file did you put this into?
I found the virtual method in the abstract class is that where you put this code?
#11
06/05/2010 (4:48 pm)
Ooops, yeah, ActorHitWall is in "ActorController"..
#12
06/07/2010 (4:08 pm)
these should be in a resource section i believe
#13
It looks like the dragon displays (some of) the animation for when he's hit (called "spaz" I think) when he's reached the top of the platform after a ledge climb. Why is that?
06/12/2010 (5:40 am)
@Will - This is looking pretty cool. Ledge climbing and wall jumping are 2 things on my list to implement too. It looks like the dragon displays (some of) the animation for when he's hit (called "spaz" I think) when he's reached the top of the platform after a ledge climb. Why is that?
#14
Well, here's the animation.

The actual code is a bit more complicated, and would take some time to convey.
06/12/2010 (10:11 am)
I needed an animation that had him turning around, because of the climb, and showed him arriving, finishing the climb. Those 5 frames worked nicely because he looks like he's finishing the climb sort of, sort of balancing, with some imagination, so i combined the 5 spaz animations, and 3 frames from climbing, and made that my beam climbing animation.Well, here's the animation.

The actual code is a bit more complicated, and would take some time to convey.
#15
Are you going to post your ledge climbing code up as a resource. Looks really good so this (and your wall jumping) is very helpful for the rest of us using the TX PSK!
06/13/2010 (7:15 am)
Cool, that makes sense. Thanks.Are you going to post your ledge climbing code up as a resource. Looks really good so this (and your wall jumping) is very helpful for the rest of us using the TX PSK!
#16
06/13/2010 (11:25 am)
Yeah, I'll definitely get the wall jump up soon. Probably be delayed with the ledge climbing since I'd like to make some changes first, and don't know when that will be.
#17
07/28/2010 (10:03 pm)
Thanks Will! This is awesome. I'd love to see the climbing up as a resource.... I will give you seven internets :)
Torque 3D Owner Will O-Reagan
Modern Intrigues