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

  • Home
  • SEARCH
  • 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 8842443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:57:36+00:00 2026-06-14T10:57:36+00:00

I’m using a raycast to determine the anchor location of a ropejoint. By using

  • 0

I’m using a raycast to determine the anchor location of a ropejoint. By using some simple draw calls, I can see that the ropejoint is being reliably created at the point the raycast returns. My problem lies in the return point. It occasionally passes through a body, returning a point on the opposite border, and sometimes inside the body. It seems to consistently fail when it does, that is to say, if I cast a ray that passes through repeatedly, it continues to pass through and return the same incorrect point. This leads me to believe there is a problem with my bodies. I am using the TextureToBody convertor for the bodies in question.

Another, lesser, issue is that i have to subtract 10/64 in each direction from my joints position to have it accurately attach. I have no idea why this is happening. (64pixels=1meter is the conversion ratio I’m using)

Raycast method:

    Private Sub castRay(startPoint As Vector2, direction As Vector2)
        direction *= 25
        direction.Y = (-direction.Y)
        world.RayCast(Function(fixture As Fixture, point As Vector2, normal As Vector2, fraction As Single)
                          Dim body As Body = fixture.Body

                          ropeContactFixture = fixture
                          ropeContactPoint = point
                          ropeJoint = New RopeJoint(Me.body, fixture.Body, New Vector2(0, 0), point - ropeContactFixture.Body.Position - (New Vector2(10, 10) / 64))
                          Return 0
                      End Function, startPoint, startPoint + direction)
    End Sub
  • 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-14T10:57:37+00:00Added an answer on June 14, 2026 at 10:57 am

    Based on my use of Farseer you should make a list of all points returned by RayCast and then sort them by distance.

    Taken from Farseers code –

         Ray-cast the world for all fixtures in the path of the ray. Your callback
         controls whether you get the closest point, any point, or n-points.
         The ray-cast ignores shapes that contain the starting point.
    
         Inside the callback:
         return -1: ignore this fixture and continue
         return 0: terminate the ray cast
         return fraction: clip the ray to this point
         return 1: don't clip the ray and continue
    

    So using this knowledge you should be able to make a list of points along the ray, find the closest, and then make the rope.

    As a side note I’m not sure why you are inverting direction.Y, but you should make sure this is what you intended to do.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

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.