• Create Account

## Cover system basics (How to move along a wall)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1lipsryme  Members

1488
Like
1Likes
Like

Posted 05 December 2012 - 07:20 PM

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, 05 December 2012 - 07:26 PM.

### #2Zipster  Members

1727
Like
2Likes
Like

Posted 05 December 2012 - 08:08 PM

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.

### #3lipsryme  Members

1488
Like
0Likes
Like

Posted 06 December 2012 - 06:22 AM

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, 06 December 2012 - 09:01 AM.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.