Hey, so I’ve been trying to create a ship system that mostly relies on physics, however I’m trying to make it more solid and reliable. Basic movement works fine, however as this video shows, any external interference causes it to move erratically.
The goal is for the ship to behave more rigidly, ideally not being impacted at all by any external forces. It already has a little dampening as you can see when I jump off at the end, however this doesn’t seem to help much.
Games like Fisch seem to manage to do this, while still relying on physics, and without a fully custom movement system (which is what I’m trying to avoid).
I suck at Roblox physics so any help would be appreciated :D
1 Like
I think I’ve found a decent solution to this issue! You can separate the parts that determine movement (parts that have forces applied to them to make the ship move) from the actual body of the ship, while still keeping them attached. What we need is basically a weld without affecting the ship’s physics.
This can be done using AlignPosition and AlignOrientation, while applying certain collision groups to your ship’s parts. This was the collision group configuration that worked best for me (ship root being the collision box, the movement parts shouldn’t collide, but should be welded to the collision box):
|
Players |
Ship Root |
Ship Parts |
Players |
|
|
|
Ship Root |
|
|
|
Ship Parts |
|
|
|
Code
local ps = game:GetService("PhysicsService")
local players = game:GetService("Players")
ps:RegisterCollisionGroup("Characters")
ps:RegisterCollisionGroup("ShipParts")
ps:RegisterCollisionGroup("ShipRoot")
ps:CollisionGroupSetCollidable("ShipRoot", "ShipParts", false)
ps:CollisionGroupSetCollidable("ShipRoot", "Characters", false)
local function onDescendantAdded(descendant)
if descendant:IsA("BasePart") then
descendant.CollisionGroup = "Characters"
end
end
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
for _, descendant in character:GetDescendants() do
onDescendantAdded(descendant)
end
character.DescendantAdded:Connect(onDescendantAdded)
end)
end)
I’m sure this is probably far from ideal, but it works for now. If anyone has any better ideas, please let me know!
1 Like