I would like to remove gravity from an area of the map. The map is space based, and is the starting area of my game. Players spawn inside a dome with all weapons available. The dome has a forcefield portal that they can go through to exit the dome and be on the outside ledge. What I am trying to accomplish is to remove gravity from everywhere outside the dome. It’s pretty strange to see weapon projectiles fly off in -x² arcs where there should be no gravity. The attached video illustrates the issue that I’m talking about. The projectiles are glowing white sticks that are 8 studs long.
I know I can set workspace.Gravity to zero, but I would like to have gravity inside the dome. I also know that I can apply a VectorForce to counteract gravity, but that would entail significantly more work, especially with weapon projectiles. So is there any way to exclude gravity from certain areas of the map?
You probably can localy use a touched function for this.
I don’t know how your dome is, but if it is made with only one mesh part, you can duplicate it 2 times.
Make one a bit smaller than the original and the other one a bit larger than the original and put them invisible.
Then with a local script, use a touched function to change the gravity while touching the invisible domes, change the gravity to 0 when touching the larger dome and normal gravity when touching the smaller dome.
You can also change the gravity depending of the CFrame or vector3 position of your character.
Something like, if your character humanoidRootPart position x, y and z are >= of a certain position then it change the gravity.
I have thought about doing something like this with the portal. Using a toggle or something every time the player connects with the portal, but that would be unreliable at best because there is no way to know if the player is entering or leaving the dome.
The dome is two separate pieces. The top part is a large sphere where the bottom half is removed and the top half is hollowed out. The bottom part that sits on the baseplate is a hollowed out cylinder. Both are forcefields with a transparency of 0.75.