PDA

View Full Version : Gravity to an objekt



Adde
09-24-2008, 04:36 PM
Hi =)
Im making a 2d (wana b mmorpg) sci fi game, and i would like to have so that
the earth im making sould have gravity
Which meens the players gets draged to the earth instead of down
and when you walk around the earth your players cframe changes and the cameras cframe changes to so the guy always seems to stay straight up when he is at the bottom of the planet
Could someone make this script for me?
I know its kinda noobish asking for a whole script but iv only scripted in lua in roblox and this doesnt look like the roblox lua, Ty
:sweatdrop:
Oh and if you play roblox im PlaceRebuilder =)

Adde
09-24-2008, 04:52 PM
maybe the camera angole should look something like:

while true do
wait(1)
local a = script.Parent.CFrame
GetCamera.CFrame = a
end

?
and what should stand instead of script parent since i noticed it doesnt work in nova

Adde
09-24-2008, 08:31 PM
local massConstant = 1

local mass = 100000 * massConstant


local min = 0
local max = 550
while true do
wait(1)
local child = entyNumber:GetID()
local relPos = this:GetPos() - child:GetPos()
if relPos.magnitude * 240 * massConstant < mass then
local canContinue = true
if relPos.magnitude * 320 * massConstant < mass then
local length = mass / (320 * relPos.magnitude * massConstant)
if childSize[n].z * length > relPos.magnitude * 2 then
mass = mass + child:GetMass()
end
end
if canContinue then
local motivator = child:FindFirstChild("BlackHole Influence")
if motivator == nil then
motivator = Instance.new("BodyPosition")
motivator.Parent = child
motivator.Name = "BlackHole Influence"
end
motivator.position = this:GetPos()
motivator.maxForce = Vector2.new (1) * mass * child:GetMass() / (relPos.magnitude * massConstant)
end
else
local motivator = child:FindFirstChild("BlackHole Influence")
if motivator ~= nil then
motivator:Remove()
end
end
end


lolz i get stuck at wait since this lua doesnt have that command
Can someone help me fix this?