3d printing my roblox avatar (excuse the crappy camera angles and lighting)
https://devforum.roblox.com/t/coder-challenge-the-fourth-dimension/1565756/23
I managed to code a place with 4D hypersphere collision.
It’s a bit counter intuitive. was initially going to reply there but it got locked.
Code
-- Code
local VelocityW = 0 -- CurrentVelocity in 4 dimension
local PositionW = math.random(-8,8) -- Position of hypersphere in 4D
local RadiusW = 4 -- Radius of sphere MAX
-- Position is of central 4d axis so we get proper values.
local THIRD_DIMENSION_W = 0 -- Plane does not move in relation to 4 Dimension...yet
local Collision = script.Parent.Collision
local Intersection = script.Parent.Visualize
local RunService = game:GetService("RunService")
local cos = math.cos
local acos = math.acos
local sqrt = math.sqrt
local rad = math.rad
local deg = math.deg
local pi = math.pi
local tan = math.tan
local clamp = math.clamp -- They cannot escape
local abs = math.abs --hard abs
-- Radius of intersection calculated by cosine. Intersection always happens at W = 0 so angle is always Cos distance from 0
local Debounce = false
local function lerp(from: number, to: number, alpha): number -- prelerprel
local diff = to - from
diff *= alpha
return from + diff -- ff
end
Intersection.Touched:Connect(function(otherPart: BasePart)
if Debounce or otherPart.Name ~= "HumanoidRootPart" then return end -- collide only pp hitbx cus other cannot hit
Debounce = true
local CF = otherPart.AssemblyLinearVelocity.Magnitude
-- LimitCollision force speed
local A = abs(PositionW - THIRD_DIMENSION_W) / RadiusW
local B = 0
if A < 1 then -- haha no edge go away
B = lerp(B,CF,A)
end
VelocityW += B
Debounce = false
end)
local function Stepped(runTime: number, deltaTime: number)
--PositionW = -10 + runTime
PositionW += VelocityW * deltaTime
PositionW = clamp(PositionW,-16,16)
local DIFF = abs(PositionW - THIRD_DIMENSION_W)
local A = DIFF / RadiusW -- CAH
local B = DIFF^2
local C = RadiusW^2
local D = 2 * DIFF * RadiusW * A -- SAS
local E = B + C - D
local F = sqrt(E) -- neg as
if F ~= F then -- neg as -ind(nan) no visualze bc size < 0
Intersection.Transparency = 1
Intersection.CanCollide = false
else
Intersection.Transparency = 0
Intersection.CanCollide = true
end
Intersection.Size = Vector3.new(F,F,F)--Boom wonderful variable names
end
RunService.Stepped:Connect(Stepped)
local ChangeUp = workspace.ChangeUp
local ChangeDown = workspace.ChangeDown
ChangeUp.Touched:Connect(function()
if Debounce then return end
Debounce = true
THIRD_DIMENSION_W += 1
task.wait(0.1)
Debounce = false
end)
ChangeDown.Touched:Connect(function()
if Debounce then return end
Debounce = true
THIRD_DIMENSION_W -= 1
task.wait(0.1)
Debounce = false
end)
This is really neat! From my understanding, 4th dimension collision is when you interact and collide with an object that is in an intersecting plane of reality, causing it to phase and the rift between our plane and its normal plane, right?
Just curious, is the object just getting scaled or is there an actual simulated ‘4th dimension’ where the objects go and move around, then eventually reappear? Also, where is that code placed in the explorer?
Yes there is an actual 4 dimension here. The only thing that might not be right is how I have handled collisions and velocity. I had a hard time understanding how collisions between a 3D character object would interact. So I made a couple of assumptions.
- The Walls are infinitely huge in the 4D plane (Ball won’t phase through wall)
- The Character is only a 3D object(Ball can phase through character)
This video you can see how they phase out of existence
I am able to calculate how large the intersection between the 3D should be using the law of cosines.
It looks like this
Yeah. I don’t think I will be able to create 4D Cubes unless I study more maths lol.
I think I am almost correct to assume that the 4D hyperspheres moves the same however I can’t “negate” the collision of the normal 3D sphere unless there is a Vector4 Module out there.
Huh very interesting. It is definitely impressive you got this far, but to further you really should implement the dicing where an object can be half-phased instead of smaller.
How do you create the wall destruction? I assume it might be procedural, but if not and it is actually just cubes, then what do you do to the cubes upon impact?
Well the filament ended up getting stuck and I couldn’t complete it lol. Also here’s some roblox legs from a previous test.
My workstation is a mess…
Dunno, just used this module: https://devforum.roblox.com/t/destructionmodule-for-in-game-destruction-needs/1191430
Oof, i just realized the numbers were made of parts, Made a selfie (nice you added freecam for all)
The free-cam is built into Roblox, so I didn’t add anything.
Ah, I forgot about that. Yes, I enabled it for people to take screenshots with.
I didn’t think it was there for non-owners unless you enabled it somehow…?? hmm, anyway check out this fire cam view:
https://devforum.roblox.com/t/how-do-i-let-other-players-use-the-free-cam/1100977
I removed the supports from the incomplete roblox print, and it actually looks half decent
Now if only I could actually manage to complete a print.
Also I cut myself a lot while trying to remove the supports-
How did plastic manage to do that?
I’d use a razor blade next time to get clean and easy cuts.
How’d you get access to PBR? I couldn’t find it in Beta Features. Is that how you got to it? Nevertheless, I love your build.
Do what? Cut me? No, I used a sharp pry tool (pretty sure its just a putty knife) and a small flathead screwdriver to pry the plastic. Turns out filament is a lot more rigid than I thought and the tools slipped multiple times so I kept stabbing myself.
Also I can’t find any gloves. ;-;
https://web.roblox.com/games/7813609752/ReadyToXDs-Place-Number-57
I’m currently working on this game, so if you want you can check it
I’m currently working on enhancing my lighting skills. I’m not using any plugins that will lag the game, too. This is 100% of my own Roblox Studio knowledge.
I think this would be progress :), although the baseplate looks a bit purple which is something I’ll have to work on, but taking that effect away will remove the purple-ish effect in the sky… When on the ground in-game, it looks normal. But when on greater heights, the purple is noticeable. Tell me what you think privately or on this topic.
Ambulance model
(decal of the Roblox Hospital thing above the “Ambulance” sign is a place holder decal)
(I made it using a reference)
VR M4 Platform
https://cdn.discordapp.com/attachments/577190202032914443/921215870720696350/Comp_1.mp4