Advertisement Jump to content
Sign in to follow this  

Cover system basics (How to move along a wall)

This topic is 2237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently trying to implement a kind of cover system for a project of mine using the UDK.
Regardless of you guys knowing how the unreal script works the answer to my question should not depend on the development environment.

What I currently have is a check (ray trace) if my character collides with a wall.
Where I get the hitLocation and the hitNormal out of that.

Currently I do:

myLocation.Z = WallHitLocation.Z;
myLocation.Y = WallHitLocation.Y;

Which obviously does not work since I need to move along the wall but this does only work for moving my character along the Z and Y world axis.
Is there some math to let me move along the wall, having stuff like the wall's normal ?

Also a second question considering cover systems. If I want my character to overcome an obstacle that he's been hiding behind. How would I translate that to the actual change of character position? Do I have to mathematically define some kind of spline with controlpoints from my location to the location behind the cover and then interpolate this position during the animation? Edited by lipsryme

Share this post

Link to post
Share on other sites
Typically you'll want to use a low-res world collision mesh that's separate from the high-res visible world mesh, so that you can put a lot of detail into the world without complicating your collision or making it prohibitively expensive.

When you do your ray trace, it should return which surface was hit, along with the normal/binormal/tangent of that surface (either directly as part of the ray trace result, or indirectly by allowing you to look up data on the returned surface reference). If your simplified collision mesh is all axis-aligned surfaces, then the movement math is really simple.

As far as moving over cover, most games use the simple approach of having all your cover be a fixed height, and then designing animations with that standard height in mind. The animation handles moving your physical character.

Share this post

Link to post
Share on other sites
So what I could do is somehow move my character along the tangent, that I calculate from the hitNormal ?

Update: the movement seems to work, but I'm still having a hard time trying to limit the movement while on the wall.
Update2: I think I've got it:

The problem I had was that I was calculating the tangent wrong. What I do now is just do a cross between the hitNormal and a forward vector on the z axis. Edited by lipsryme

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!