# 2D aim constraint like behavior (orientation with quaternions)

## Recommended Posts

Hi, am not quite sure if this is the right place, but I am using mostly vex/vops for this exercise so I'll post here. I would like to do an aim constraint setup with the possibility to turn an axis off (to switch from 3D to 2D so to speak). In my proof of concept I am isolating the case, when I have already picked a locked of axis (should rotate around Y), so:

1) I calculate the vector between the target object and the rotationa pivot

2) I define a plane (more like a a vector) through the rotational pivot

3) I do a dot product between the both vectors

4) I jump into VOPs, feed the dot product into trigonometric functions VOP set to arc cosine -> feed to the angle of quaternion -> rotate quaternion -> update P.

So far so good, the oriented object behaves great in the space between 0 and PI  (180), which is the return of the arcus cosine function... Also, dot product returns a value between -1 and 1, which fits the 0 to PI paradigm. When I move the target object below the rotational pivot, I got flipped rotation, which is to be expected but very undesired.

I want to have full rotation tho, does anyone have an Idea what  I can improve/change/use to get the 0-360 rotation (without JUMPS between quadrants)? I feel kinda stuck, thank you in advance!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×