[Release] Custom character controller

Despite changing the fall I still find myself falling off some edges, but for the most part is fixed. Its wierd that its only a few parts. https://i.gyazo.com/36e8c18a9aae26e3c21bf5d9a2f759cf.gif

2 Likes

I really hope someone can make a camera that follows your character upside down, I’m trying to use these for my games.

2 Likes

I tried making such a script. But it doesn’t seem to be possible. When the camera is pointed directly up or down, it does some weird glitches. This is why you can’t look straight down or up in Roblox :slightly_frowning_face:

2 Likes

Yes you can look straight up and straight down. The custom cameratype just prevents you.

1 Like

Yeah, it prevents you for a reason. When looking straight up or down with the scriptable cameratype, it does some weird stuff.

2 Likes

Well the reason is because the default CFrame constructor in the form CFrame.new(pos, lookAt) uses code equivalent to:

local cf = {};

function cf.new(pos, lookAt)
	local b = -(lookAt - pos).unit;
	local dot = b:Dot(Vector3.new(0, 1, 0));
	
	if (math.abs(dot) < 1) then
		local r = -b:Cross(Vector3.new(0, 1, 0)).unit;
		local u = -r:Cross(b).unit;
		
		return CFrame.fromMatrix(pos, r, u, b);
	else
		return CFrame.new(pos.x, pos.y, pos.z, 0, 1, 0, 0, 0, dot, dot, 0, 0);
	end
end

Basically, since the code assumes that Vector3.new(0, 1, 0) is up it has to pick default values for the right and up vectors in the CFrame. This in turn causes a singular rotation for situations when a uses the above constructor to be set looking up or down.

The only real way to get around this is to have some other axis defined other than back (-lookVector) when creating the rotation matrix. Although I didn’t use it for the camera, iirc in the above placefile I use a similar concept for the controls by using the right axis of the last thing that wasn’t facing directly down.

Probably just made that way more confusing, but that’s the jist of why it does that. :stuck_out_tongue_winking_eye:

12 Likes

Well, try copying how meguy1 did it with Gravity Shift.

3 Likes

Mygame43 “cheated” with Gravity Shift in that the “down” lookVector always points toward gravity. So no real change to the camera code.

2 Likes

I’d rather have whatever’s possible that can be done, so I can actually use a dynamic camera for my game.

2 Likes

If you just want to be able to look in all 360 degrees, try setting the downVector to always be 90 degrees below the lookVector. It’s an ugly fix but it will absolutely prevent the camera from stopping when it hits the bottom or top of the possible camera angles.

You should quickly realize why the camera is limited like it is currently, when you do.

7 Likes

And just how would I go about doing that?

2 Likes

This topic should get you started in advanced CFrame math. I’m not willing to dive into the scripting it would take to create a 360DOF camera, especially not for free; there are lots of professionally made games which use such technology.

4 Likes

Roblox could implement quaternions under the hood. It would make animating joints probably way easier.

1 Like

Is that me?

8 Likes

Yessiree!

3 Likes

fascinating!!!

2 Likes

Wait, just a question.

Is there any way it’d be possible to have this same effect, but on terrain ? If there is, please let me know!

2 Likes

Unfortunately with the way I approached the problem terrain isn’t really a possibility.

In most cases I can change the fake humanoid’s fake world to rotate around the player, but with terrain that’s not possible since you can’t rotate it. I can’t make a “fake” terrain out of bricks either because not only would that be inefficient but also we don’t have access to that information atm.

3 Likes

Mind explaining how it works?

I am looking forward to using stuff like this!