1
$\begingroup$

Why the result of ray_cast function is giving me that result? The hit point should be Vector(0.5, -1.0, 0.0), but it is returning Vector(0.666..., -1.0, 0)

I have tried a lot of combinations to try to understand what is wrong, but no clue of what happens, so I decide to ask it here.

Results Results2

$\endgroup$
3
  • $\begingroup$ Yes, it is the default cube. I double check and the two vector (v1 and v2) are what is showed in the image. $\endgroup$ Commented Jun 17, 2016 at 16:36
  • 2
    $\begingroup$ Related blender.stackexchange.com/questions/50716/… You are ray casting from v1l in a v2l direction, it's not from-to. $\endgroup$
    – batFINGER
    Commented Jun 19, 2016 at 13:40
  • $\begingroup$ Thanks batFINGER... In fact the function cast_ray expects a initial vector and a direction, giving by (vector2 - vector1).normalized()... Now it works as expected. $\endgroup$ Commented Jun 19, 2016 at 21:33

1 Answer 1

1
$\begingroup$

Thanks to batFINGER, I found the error. The ray_cast function should be supplied with a point (v1, in my example) and the normalized direction, reached by (v2 - v1).normalized(). Now it is working as expected.

Solution

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .