This page looks best with JavaScript enabled

Resources

 ·  ☕ 2 min read

Python

https://github.com/taylorbenwright/PySide2Widgets

This repo contains a growing collection of convenience widgets/layouts for use with PySide 2. Run demo.py from a console to test them out.

I just add this as a submodule to any project I make.

https://github.com/taylorbenwright/TechnicallyTools

This is my general-use DCC toolbox. To install it, just run the .bat file at TechnicallyTools\tgMaya\MayaEnv\bootstrap that goes with your version of Maya.

Unreal

https://github.com/taylorbenwright/TechnicallyToolsPlugin

This repo is for general use Unreal functionality.

Math

It often comes up that you’ll want to rotate a point or an object through space along some plane. The following pseudocode does just that: given a point you want to rotate, the origin of that rotation, and the normalized upvector of that rotational plane, rotates the point about the center by theta radians.. Note, the cross product in line 4 may need to be negated based on if you’re in a right-handed or left-handed system.

vector RotateVectorAboutAxis(vector p, vector o, vector n, float theta)
	vector zeroedPosition = p - o;
	vector rightVec = zeroedPosition.normalize();
	vector upVec = cross(rightVec, n);
	vector newRight = cos(theta) * right + sin(theta) * up;
	vector rescaledRight = newRight * zeroedPosition.magnitude();
	return o + rescaledRight;

vector RotatedVector = RotateVectorAboutAxis(PointToRotate, RotationOrigin, AxisNormal, .3);

This is a useful one for IK, but also just general purpose.
By definition, the closest point on a flat plane to another point out in space is the one at which, if we were to draw a line segment between the two points, the normal of the line would be perpendicular to the face of the plane. The following equation will give you that answer, regardless of the orientation of the plane.

vector ProjectPointToPlane(vector p, vector o, vector n)
	vector offsetPtoO = p - o;
	float distance = dot(offsetPtoO, n);
	return p - distance*n;

vector ProjectedPoint = ProjectPointToPlane(PointToProject, PlaneOriginPosition, PlaneNormal);

Obviously, PlaneNormal needs to be normalized.

Share on