   (Sliding Collisions) I have the direction vector, the surface normal, now what?
  So, I have collisions working fine using Opcode RayColliders, but I'm now at the stage where I need to be able to slide across surfaces collided with.I have all the required information, Direction Vector of Collision, Surface Vector of Collision(I.e the normal of the tri) but I'm at a loss at what to do with the information.Anyone have any quick code they can show me, or could you list the steps I must take? I seem to recall it's something to do with multiplying the Direction Vector by the surface normal, but I'm not sure really.Thanks,   
  If there is collision:Directionvector+SurfaceNormal*Abs(DotProduct(SurfaceNormal*DirectionVector))Is a vector along the surface that you are colliding with; the 'sliding' vector   ;Quote:Directionvector+SurfaceNormal*Abs(DotProduct(SurfaceNormal*DirectionVector))Thanks, can you clear something for me. I'm just doing a vector class but there's one thing I'm not sure. What do you do when you multiply a 3 part vector by a one part float?The above for example, in C++ would it be, Vector3 myVec = DirectionVec+SurfaceVec; myVec.x *= Abs(Dot(..etc)) myVec.y *= Abs(Dot(..etc))or is there a special way of multiplying?I'm using a langauge that doesn't allow overloaded operators so I have do it manually.   ;  Also you have a DotProduct on just one vector. How is that possible? In every vector lib I've ever used a dotproduct is taken from two vectors?Or is the left side of the equation being used? I.e is itVector3 MyVec = DirVec+SurfVecmYVec.DotProduct( Vector3.Abs( SurfVec+DirVec) )?;  Ok here's the closest I could get to your equation, it does not work. it hits the geo, judders for a split second then stops, my only option to retreat away from the wall rather than sliding into it.Local ptri = ent.pickedtriLocal nx#,ny#,nz#nx = ps.trianglenx(ptri)ny = ps.triangleny(ptri)nz = ps.trianglenz(ptri)Local DirVec:Vector3 = Vector3.Create( xi,yi,zi )DirVec.Normalize()Local SurfVec:Vector3 = Vector3.Create( nx,ny,nz )SurfVec.Normalize()Local Vec1:Vector3 = DirVec.Add( SurfVec )Local dp# = Abs(SurfVec.Dot( DirVec ))Local Vec3:Vector3 = Vec1.multiplySingle( dp )xi=vec3.xyi =vec3.yzi =vec3.zCan you spot where I've gone wrong? The language is Bmax.   ;  A slide is kind of like a reflection, except you just remove the component in the direction of the plane normal instead of reflecting it. So if an object with initial velocity vi collides with a plane with normal n (unit vector), its slide velocity is vi-(vi.n)n (or, in code, slideVelocity = initialVelocity - (Vector.DotProduct(plane.Normal, initialVelocity) * plane.Normal)).   ;  I tried that and it still doesn't work for some reason. the collisions are definitely working because it stops as soon as it hits the wall and just fails to move.here's the code, based on your equation. Have I made a mistake?Local ptri = ent.pickedtriLocal nx#,ny#,nz#nx = ps.trianglenx(ptri)ny = ps.triangleny(ptri)nz = ps.trianglenz(ptri)Local DirVec:Vector3 = Vector3.Create( xi,yi,zi )DirVec.Normalize()Local SurfVec:Vector3 = Vector3.Create( nx,ny,nz )SurfVec.Normalize()'slideVelocity = initialVelocity - (Vector.DotProduct(plane.Normal, initialVelocity) * plane.Normal))Local dp# = surfVec.dot( dirvec )Local vec1:Vector3 = surfVec.multiplysingle( dp )Local vec2:VEctor3 = dirVec.subtract( vec1 ) xi= vec2.xyi =vec2.yzi =vec2.z;  ok spotted the mistake, I was incorrectly normalizing the initial velocity vector.It now works if I run into the wall and let my momentum carry me into the collision. it slides properly. But I run constantly into the wall it gets stuck. but the second i let go of run it slides in the appropriate direction.Any idea how to tackle this?   ;  Well, if the slide works when you're not pressing any controls, the problem is not in the collision code as such. My guess is that your 'I just ran into a wall' code is repositioning your character at the position it was at the start of the frame. You need to look at the way your control code and collision code interact.   ;  Yeah it was just a stupid mistake on my part. I only incremented the players position by it's inertia if there was no collision. so of course when running into a wall it was constantly colliding so although the new inertia was accurate it was just not being applied.