CFrame.fromAxisAngle returning NAN

I’m using CFrame.fromAxisAngles to calculate a plane to carry out calculations however CFrame.fromAxisAngle(Vector3.new(0,0,0), 0) returns 0, 0, 0, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN.
How do I prevent this from happening?

A video to show what I mean:

Your calculations for midPoint is wrong. You can do:

local midpoint = p1.CFrame:lerp(p2.CFrame, 0.5)

Lerp returns a point In between two points based on an alpha (a number between 0 and 1). For example, if alpha is 0, it’ll return the first point (start), if alpha is 1, it’ll return the second point (the end), if alpha is 0.5, it’ll return a point in between the start and the end

2 Likes

Oops, forgot about lerp, have simplified my code now.
This doesn’t resolve my issue but my code looks neater :slight_smile:
Do you know how I can fix this?

managed to figure it out by doing this:

if axis == v3() then 
	if angle == math.pi then 
		axis = v3(-1,0, 0) 
	else
		axis = v3(0,0,-1)
	end
end