Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find intersection point
#1
Hi,

I have an object which is moving towards the spline. 
How would I find the intersection point of my object's forward vector and the spline (projected on the xz plane)? 
So basically, I want to find out where my moving object is going to hit the spline when it moves forward. 

Thank you
Reply
#2
Hi
You can find an API method here that gives you the nearest point of a ray from a spline. Once you get that point, check if that point is part of the ray or not to know if the ray indeed intersects the spline.
Did this help?
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Hi,
I did not find any method with a Ray as an input.
Thanks.
Reply
#4
(10-17-2022, 07:06 PM)soccertrash Wrote: Hi,
I did not find any method with a Ray as an input.
Thanks.

It's in the post I post the link for. That post contains code you need to add to two files, and the method is GetNearestPointTF(Ray ray, .....)

Is it clear now?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
Ah, I missed the link. Thank you.

I integrated the code you posted on the other thread. The member mStepSize is not on CurvySplineSegment any more. How can I fix this?
Thank you!
Reply
#6
(10-21-2022, 01:18 PM)soccertrash Wrote: Ah, I missed the link. Thank you.

I integrated the code you posted on the other thread. The member mStepSize is not on CurvySplineSegment any more. How can I fix this?
Thank you!

Hi
mStepSize was a private member that was removed since. I updated the code in the referenced post to make it work without the mStepSize member: I replaced it's value with:1f / CacheSize
Please let me know if you find any issue.
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Connection "next' control point jh092 3 15 11-22-2023, 11:47 AM
Last Post: _Aka_
  Spline.Length not updated unless I add a point to spline (or modify it) first. _RicO 3 6 08-26-2023, 08:41 AM
Last Post: _Aka_
  How do I get the closest Spline Control Point Lupos 2 16 05-12-2023, 01:59 AM
Last Post: Lupos

Forum Jump: