On Tue, Nov 24, 2009 at 21:56, Matt Hoffman <lord.matt.hoff...@gmail.com>wrote:

> I'm trying to go about figuring out what an efficient way of creating
> 'ledge
> movement' for Source would be.
>
> What I'm trying to accomplish is similar to Mirrors Edge and Assassins
> Creed
> where you can jump and hang onto a ledge and move left/right and climb up.
>
> Ideally I'd like it to work on both static brushes, moving brushes, and
> models.
>
>
> What would the ideal way of doing this be? My interpretation would be as
> follows:
>
> 1: Trace out to the wall
> 2: Find the edges of the brush using GetBrushesInAABB and GetBrushInfo
> 3: Compare the distance of the player to the top edge. If it's less than X
> amount, move them to the edge
> 4: Constrain movement to left/right
>
> However, this would be a very constrained movement would probably only work
> on a flat surface wall, and nothing like cylinders or something with a
> ledge.
>
> Has anyone ever tried implementing this kind of movement in source, or have
> any ideas?
>
> Thanks.
>
>
This has been done in the Dystopia mod in ClipVelocity() using
UTIL_TraceRay() with MASK_PLAYERSOLID and COLLISION_GROUP_PLAYER_MOVEMENT
masks. You also got to check the angle between the player's eyes and the
surface's normal among other things.

Once you grabbed the ledge you can hook your movement code into
PlayerMove().

I can't tell if it's the best way to do it but it works. It might also
requires some work with animations and prediction.

-- 
Mandibull
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to