How would I make a third person gravity controller/wall walking camera?

I’ve been creating a custom “gravity” system, (like gravity controllers where you can walk on walls + roofs, but i’ll be using the example of a planet here) and since from what i can tell the Humanoid will always try to force its character “the correct way up”, I spent my time remaking the Humanoid’s movement system to allow for all other gravity directions (walking, climbing, sitting, etc.) where a Vector3 value is used to describe this new direction of gravity (normal gravity would be (0, -1, 0), and so on for other orientations)

my issue now is fixing the cameras standard behaviour to follow a new perspective of the character as they rotate around the planet:

image

so that it instead uses the Vector3 for the current gravities direction, to orientate it accordingly (something like (-1, 0, 0) in this case)
image

i assume an existing method/modulescript exists for a similar purpose however if not i still think it would be helpful if anyone could let me know how i would actually go about doing this myself (as i really dont know how lol)

replying here just to bump the post but also a mini rant here; i’ve noticed that alot of my posts either get responded to quickly, or when the question is not so straightforward, i’ll wait at least 2-5 days to either wait for a response to get the question moving or just try and figure out a solution on my own, due to no response at all…

am i structuring my question poorly here? is my question too confusing? or is everyone scrolling past because they have an understanding on how to create a custom camera system, but expecting someone else to know existing code that can be used instead of reinventing the wheel? i would prefer a response detailing a tutorial, existing module or simply a way to grasp how i would go about recreating a custom third person camera system that i could try and adjust based on my needs here, compared to no reply at all, especially as this is one of those topics where its practically impossible to try and figure out a solution alone with no prior knowledge :confused:

I get what you’re trying to do, and it’s probably possible via some cframe math. If I had to guess an easy way to do this, I’d look into the default scripts and try to find anything that returns a default camera value. From there I’d multiply it with some angles from the HumanoidRootPart of your character.

As for the actual math and logic behind it, I don’t really know where I’d begin. I’m pretty bad with CFrame math. However, I do have a few ideas.

You could start by just putting the camera above the humanoid rootpart at a fixed distance and orienting it to face the humanoid root part direction. It’s certainly not ideal, but it would be the easiest to make. If you want zoom and rotation, it’s much more difficult.


I did find the source code for EgoMoose’s Gravity Wallstick controller.

Digging further into the github you can find a script named init.client.lua, which looks to be where he creates a fully custom camera (or close to it).


Sorry I couldn’t be of more help, as CFrame math just isn’t really my thing. But I do hope that these resources I found help you out!


This just kind of seems to be the reality of the devforum. If your question isn’t easily answered by a google search or two, its a complete dice roll whether or not you actually get help w/ your issue. I’ve struggled with this in the past, and really the only choice is to just make a new post or keep slamming your head against a desk until you find a solution lol.

my exact position right now :weary:

I have actually already considered this while making an existing and functional first person camera script (that was the best i could do on my own lol) where the player may expect a more responsive camera to the characters movement, however one of the main issues i saw with implementing the HumanoidRootPart’s CFrame in the math is that it means your camera shakes alot when put in any form of ragdoll state. (in my testing it was a chair suspended on rope but if i were to implement a ragdoll upon death or any section of my game where gravity is weak enough to float and spin around above the planet, i think you could imagine how that would look) and so would most likely get complaints about motion sickness, which is why the original post asks more of trying to rely on the direction of gravity, aka general reference point for where the “ground is”, like how the standard third person camera feels as if it stays the same rotation regardless of how you get thrown around because you always expect to look straight down and see the ground/map below you, and vice versa for straight up

i have actually also considered looking at existing gravity controllers when designing my own gravity system, however what i’ve noticed is that alot of them are actually pretty old and most are pretty jarring from a player perspective when adjusting their gravity, which is exactly what im trying to do, especially EgoMoose’s attempts/older versions that i’ve seen :sweat_smile: also im not sure if you noticed/checked, or if i was looking at an outdated version but when i looked at their game file and went to playtest to see if their camera script/s do what im looking for, they dont actually change the camera at all as you walk around the map… kinda makes sense for this implementation but at the same time obviously not very helpful :man_shrugging:

image

(not sure if im highlighting the last paragraph of your reply wrong or if the spoiler doesnt let me quote it lol, i’ll just respond to it here)

yeah, i’ve kinda noticed this slow process with other “scripting help” discord servers except over there its significantly less people and its practically useless to ask anything that requires someone to respond who has already had experience and/or knows a solution to your issue, its just that here there are a significantly larger amount of people so i feel like asking here is the best bet for your time

changed the title to be more straightforward… i’ve also been investigating why EgoMoose’s gravity controller camera wasnt working for me and it looks like the “Playground’s” camera has been broken some time recently, and i dont really want to revive its original post from 2020 :sweat_smile:

found the solution within another posts comment section with the help of another user, anirudh851, within their comment where you can find a specific reply in one of EgoMoose’s posts detailing how he went about doing this and implementing it himself, along with the file to his modified camera result that I was looking for; and for anyone looking over this comment and possibly later getting a similar issue that I did relating to the default CameraType, you’ll need to change it to “Track” to stop it from freaking out and spinning rapidly around 2 seconds after panning your camera when it tries to “auto-adjust/align/rotate” (all the names i saw when trying to find the solution to the issue lol) as shown in a post i made about the issue

yikes, that was like explaining a whole movie plot but its just what i had to go through over the past 3 days just to figure out a functional solution to this original post lmao

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.