Hi! I’m currently working on a droplet simulation effect. The droplets drip down the parts surface with gravity.
This works perfectly when using the front of the part (Enum.NormalId.Front
)! The droplets properly flow down the surface, while respecting the cframe of the part:
However, when using other faces, things begin to fall apart. Here I’m using the left face of the part (Enum.NormalId.Left
), and you’ll notice the droplets aren’t moving with the world gravity anymore:
How can I fix this? The “GravityVector” should be a Vector3 with just the XY representing the surface-relative force to move with world gravity.
Here’s a modified snippet of my code:
...
local NormalId = Enum.NormalId.Left
local Normal = Vector3.FromNormalId(NormalId)
local WorldGravity = Vector3.new(0, -5, 0) * DeltaTime
local GravityVector = PartCFrame:VectorToObjectSpace(WorldGravity) -- Force relative to the surface
...
-- Later on
local NewLocalPosition = Droplet.LocalPosition + GravityVector