Hi all, there is a question: I want to make a gravity field for part (similar to the game Exploring the Solar System 2), if the player will fall into it, then his character will turn to the position part and, accordingly, attracted to it. So far I can only track at what distance is the player’s character from the position part. What are the variants of the solution?
You want to make the players get pulled to the part?
If yes, then here’s some stuff you can do.
- Using BodyPosition
local Character = script.Parent
local Root = Character.HumanoidRootPart
local BP = Instance.new("BodyPosition",Root)
local TargetPosition = Vector3.new(0,100,0) -- where the player will be pulled
BP.Position = TargetPosition
- Using BodyVelocity
local Character = script.Parent
local Root = Character.HumanoidRootPart
local BV = Instance.new("BodyVelocity",Root)
local Speed = 40
local TargetPosition = Vector3.new(0,100,0) -- where the player will be pulled
local LookVector = CFrame.new(Root.Position,TargetPosition).LookVector
BV.MaxForce = Vector3.new(9e9,9e9,9e9)
BV.Velocity = LookVector * Speed
There are couple more ways to do this, but personally I think those are the best ones. Might be wrong though.
1 Like
I’ll try it a little later and post it
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.