0
$\begingroup$

Hi and good days to everyone.

What I have been trying to accomplish is rotating the plane (in the image below) in its x (red) direction until it aligns with the top vertex of the cone. Is there a way for me accomplish this via scripting? My tryouts have given me no result.

Edit: I have added a picture how it should look. And top of the cone is just a point. It could be 3d cursor.

enter image description here enter image description here

$\endgroup$
  • 1
    $\begingroup$ you mean the normal of the plane should point to that cone vertex? or? $\endgroup$ – m.ardito Nov 8 '17 at 13:48
  • $\begingroup$ Rotating around what? $\endgroup$ – Maxx Nov 8 '17 at 14:14
  • $\begingroup$ @Maxx, Origin point of plane. It's shown in first picture. $\endgroup$ – user2344448 Nov 8 '17 at 14:25
  • $\begingroup$ Ok. Why do you need it via scripting? Are you assuming it can't be done otherwise? Or do you really need it via scripting (for instance, you are developing an addon)? $\endgroup$ – Maxx Nov 8 '17 at 14:54
  • $\begingroup$ @Maxx, No I am trying to automatise a process that I do everyday by hand. :) $\endgroup$ – user2344448 Nov 8 '17 at 15:37
0
$\begingroup$

Here is how I would do it. I'll just show a workflow for doing it with constraints and blender operators. I assume you will manage to code the same process in python?

I add an empty which is the point you want to track. I had a child cone for consistency with your image ;-).

enter image description here

I add another empty with a set of contraints :

enter image description here

And then I add a constraint to the plane's object :

enter image description here

It is over, the plane is like you want. Now you can either leave it as is. You can move the first empty, and the plane will follow it. Or, you can select your plane, and "Apply visual transform". And then you can delete everything you don't want anymore.

enter image description here

Now you can do these steps in python ! I guess it is slower than computing directly the good rotation with some trigonometry, but it has the avantage og being simple, plus you can still move your point at the end !

| improve this answer | |
$\endgroup$
  • $\begingroup$ I didn't know how to put a point with directions, so I used a cone :D $\endgroup$ – user2344448 Nov 8 '17 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.