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$
11
  • 1
    $\begingroup$ you mean the normal of the plane should point to that cone vertex? or? $\endgroup$
    – m.ardito
    Commented Nov 8, 2017 at 13:48
  • $\begingroup$ Rotating around what? $\endgroup$
    – Maxx
    Commented Nov 8, 2017 at 14:14
  • $\begingroup$ @Maxx, Origin point of plane. It's shown in first picture. $\endgroup$ Commented Nov 8, 2017 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
    Commented Nov 8, 2017 at 14:54
  • $\begingroup$ @Maxx, No I am trying to automatise a process that I do everyday by hand. :) $\endgroup$ Commented Nov 8, 2017 at 15:37

1 Answer 1

1
$\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 !

$\endgroup$
1
  • $\begingroup$ I didn't know how to put a point with directions, so I used a cone :D $\endgroup$ Commented Nov 8, 2017 at 16:45

You must log in to answer this question.

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