So I modified egomoose’s wallstick controller and found that it gives weird CFrames when I get more than 10k studs away from 0,0,0
how weird do the values get? usually numbers start to fuzz once the positions go to the millions, but I think some of that could still happen with 10k
i dont even know why youre going 10k studs away… but i guess thats something we can discuss later lmao
So Im working on a procedurally generated planets game and I started getting these weird CFrames.
I initially thought they were caused by floating point errors however I started testing and the maximum distance beforme these numbers started getting really akward was 10k studs away from 0,0,0.
Also beyond 4k studs the numbers start to get weird already.
The weird thing is that it seems as the distance from the character to 0,0,0 doesn’t really matters and the actual thing that affects the CFrames is the planet’s primary part position
And they get like, really weird, I might’ve found the line of code that causes it:
floor.CFrame = CFrame.new(WORLD_CENTER) * getRotationBetween(self.Normal, UNIT_Y, UNIT_X)
floor is a part thats created on the client and it gives the character its rotation.
Center is equals to: local WORLD_CENTER = Vector3.new(10000, 0, 0)
i think ive seen a similar game that uses the trick where it keeps the player around the center and actually moves the environment to the center so that big values dont get tricky
dont know the implementation details and I think it might be pretty hard to implement, so this might be a last resort lol
im not a CFrame math gal by any means but that 10,000 really starting to look suspicious
recordings on how wonky it gets can also be helpful, cause idk HOW wonky it is or whether its the position or the rotation
moving the whole planet is not really an option as they’re 20k studs diameter aproximately and have thousands of assets inside.
And here are some videos of the controller failing: (btw its just the rotation thats weird)
Ok so this is a planet thats on 0,0,0:
and this is a planet on 0,10000,0:
You should check out this post on planetary gravity for your solution, there is a YouTube video linked in the answer:
the problem is that egomoose controller stops working past a certain distance.
Anyway I appreciate the reply
btw dont listen to ivy shes a known troll on these forums
JESUS CHRIST thats cool and also slightly bit weird and haunted
it seems like the problem might be on self.Normal (since I assume everything else is a constant)
last resort might be to hard code some rotation values once position magnitude goes above 4k… but i want a smarter solution lolol
man i got some serious opps here
yo so im trying to comb thru the source code of of the module through the github repo (GitHub - EgoMoose/Rbx-Gravity-Controller: A Roblox module for allowing characters to defy gravity) and im finding no results for floor.CFrame
do you know which script and which line its from?
the script is named “WallStick”, it is a module inside a script named “WallstickServer” and the code line is 274
yeahhhh couldnt find it in the github or egomoose’s provided demo place (Wall stick Controller - Roblox)
are you sure u got the right script?
nutn in the replicatedstorage script either
LOL, I don’t remember why I placed it inside WallStickServer.
I think I took a previous version of the place I can provide you with my modified code
Oh yeah, it has been updated. (words(
aight
hit it chief! (if ur comfortable with sharing ofc)
currently the only progress we have is with potential floating point errors with self.Normal
other than that we got nothing lol
code.rbxm (146.3 KB)
these are the codes.
I just modified it so that I can have control of when the raycast occurs and stop the character just sticking to mountains
(sorry for the long wait got lunch with my family)
oops
looks like this is a pretty heavily modified version that relies on some instances that only exist on your place
nothing too wrong from the first impressions i got from the code though
judging from OnStep, there seems to be no rounding issues or strange behavior in general (other than GetFloorAndNormal but i get it your entire map is terrain)
its very weird that it starts to bug as early 4k studs and especially the rotation
im not sure about stuff after that though
from what ive seen it is a bit wacky that youre adjusting the rootpart position in both the server and the client, but afaik this shouldnt be too much of an issue
the event named “TP” is to disable the controller when the player is being teleported as the controller doesn’t allow the CFrame change.
good to know
at this point, i dont know how to help you further since im not the most well versed in CFrame math or Egomoose’s projects
you can wait until someone much smarter than me can tackle this question, or you can shoot a DM to egomoose yourself to see what he has to say about it
good luck on ya project!