Notifications
Clear all

[Closed] Rotation, among other things

What I’m trying to do is rotate an object, in this case a cylinder, to always point at another object. When I started thinking about it, I figured it would be a bit of trigonometry, an easy thing to do.

The part I’m snagged on is after I find the angle that the cylinder needs to be pointed, how do I set the absolute world rotation?

I hope I’ve been clear. I’ll probably be asking more questions shortly, so stay tuned for more;)

EDIT:

I seemed to have figured out how to do that myself. I guess it helped just to type it up and put it in words, allowed me to better reason what I wanted to do.

Here’s my solution for simply finding and changing the absolute rotation of the cylinder, tell me if something is wrong:

cyl_pos = $cylinder01.pos
cyl_rot = inverse $cylinder01.rotation as eulerangles
(at which point it spits out what the angle was, just so I could see what was going on)
cyl_rot = inverse eulerangles 0 -70 0 as quat
$cylinder01.rotation = cyl_rot
(that’s me changing it to some arbitrary angle just to see if it would work)
$cylinder01.pos = cyl_pos
(cylinder seems to move when rotating, so I just set the position to its previous value)

2 Replies

Do you really need to script it? Why not use a look at constraint?

Well, I’m new to this… don’t even know what a look at constraint is.

Can someone tell me how to use it?