2
$\begingroup$

Update: please check the end of the post I may have found a solution.

I'm making a node tree whose purpose is to tilt the points of a curve so they face a reference object. A Plane is generated from the curve and so it also faces the reference object. I think I am almost there except for a problem of angle calculation.

Here is the test file:

In the following example, I am attaching a 3D gizmo to the faces of the reference objet (a sphere) as well as the curve points. The idea is to calculate the angle difference on a specific axis between the reference object closest face's normal and a vector of the curve point (here tangent) then set the tilt to that angle. This seems to be working except sometimes some rotations change range such as moving from -64° to 114° when moving the last curve point (the one selected on the example file when opening it).I guess I have to clamp the angles in some way but I am not sure how to prevent them from skipping like this and what the right range should be.

Here is a screen of the last curve point having wrong tilt as well as the node tree applied on the curve:

enter image description here

enter image description here

UPDATE: I have a potential solution for this using quaternions: instead of using Rotation To Euler before subtracting the two angles, I used Rotation To Quaternion. Then I got the W of each quaternion using cos(Z/2) and made the subtract on these. So far it looks good, I'll update the post if I find any issue.

$\endgroup$
6
  • 1
    $\begingroup$ related: Trimming start of the curve geometry nodes without altering tilt - sample nearest surface normal, and use the angular difference between it and current normal as the curve tilt. $\endgroup$ Commented Jun 19 at 19:40
  • 2
    $\begingroup$ Just want to be sure this doesn't take you most of the way in Blender 4.1.1 : imgur.com/a/Ej9y3h6 $\endgroup$
    – Robin Betts
    Commented Jun 19 at 19:55
  • 1
    $\begingroup$ @RobinBetts ohhh it's a new feature! I thought I was reading the 4.1 changelog but missed it somehow... $\endgroup$ Commented Jun 19 at 20:09
  • $\begingroup$ @RobinBetts thank you! This is much simpler than what I was doing and seems to be working fine. You can set it as answer if you wish! $\endgroup$
    – Alio
    Commented Jun 20 at 6:46
  • $\begingroup$ Hi, @Alio! Great! could we leave that to you, to self-answer? I have to be unexpectedly AFK for a while. $\endgroup$
    – Robin Betts
    Commented Jun 20 at 8:52

1 Answer 1

2
$\begingroup$

@Robin Betts made a comment above which answers the question, providing a much simpler solution than the one I was implementing. Check it at https://imgur.com/a/Ej9y3h6, I am pasting the images below as well.

enter image description here

enter image description here

$\endgroup$

You must log in to answer this question.

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