Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:23:10+00:00 2026-06-06T09:23:10+00:00

Alright, so I have this collision detection code, and I’m trying to push the

  • 0

Alright, so I have this collision detection code, and I’m trying to push the remaining distance (move from 0 to +5, wall at +2, remaining = +3) across the plane of the wall. Like this:
enter image description here

Now I got most of it down, I know I need the remaining distance from the move, and the cross product of the normal for the wall, but I need some help getting the forumula right.

My question is, whats’s the correct forumula for to move the remaining distance along the plane of the wall?

if(distRemaining.length() > 0){
            cProduct = cross(distRemaining, wallNormal);
            dest += new Vector3f(cProduct.x, 0, cProduct.z);
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:23:11+00:00Added an answer on June 6, 2026 at 9:23 am

    Call your start point A, and the point of impact B, and the normal vector N to your wall plane. Calculate the vector that takes A to B (AB) and calculate the vector product between it and N. Call this X

        X = AB x N
    

    This is a vector perpendicular to both N and AB which also lies in the plane of your wall. Take a further vector Y as the vector product between X and N

        Y = X x N
    

    This is now a another vector in your wall that points in the direction of motion of your particle ALONG the wall after your collision. You will need to normalise this vector Y (calculate Y / |Y|) and multiply it by the amount you want to move along the wall, then add it to your collision point B. It is possible that this vector will point in the opposite direction but if you are careful with the order that you take the vector products you should be fine.

    This is how you could do it in 3D which I am assuming you want from your question. In 2D it would be considerably simpler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code, it looks alright and is really basic, but i can't
Alright, so I have this bit of code, and when I make the request,
Alright, this problem seems to be way above my head! I have this code:
Alright I have the MYSQL query code setup to pull this information out of
I have written this piece of code here and I have linked it alright
Alright, I have this program to sparse code in Newick Format, which extracts both
Alright I have been trying to figure this out and I read the MSDN
Alright so I'm trying to get captcha to work here and I have this
Alright I know this is more than likely a amateur question but I have
Alright, this one's interesting. I have a solution, but I don't like it. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.