Ethan
New Member
Posts: 2
ROBLOX Username: bigboy77584
|
Post by Ethan on Jun 9, 2017 3:14:56 GMT
Hi guys! This is my first post on this forum. I have been trying to script a rocket that uses CFrame to move. I have gotten it to work with a constant acceleration but after converting meters to sutds, it seems wayyyy too fast when I am testing it. I think it could be a problem with my script but I am not sure. In my script, it is accelerating at 20 studs per seconds squared or approximately 1 meter per second squared. Here's the script:
Also, the camera follows the movement of my rocket, but I can't actually see the rocket???
insert code here local cam = workspace.CurrentCamera
local position = workspace:WaitForChild("pos")
local focus = workspace:WaitForChild("focus")
local player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
--[[
player.CharacterAdded:connect(function()
cam.CameraSubject = focus
end)
]]
--cam.CameraType = "Custom"
local part = {}
function part.new(acceleration, velocity, position)
local self = setmetatable({}, {__index = part})
self.acceleration = acceleration
self.velocity = velocity
self.position = position
return self
end
function part:Update()
self.velocity = self.velocity + self.acceleration
self.position = self.position + self.velocity
end
local rocket = part.new(Vector3.new(0,6.67,0), Vector3.new(), focus.CFrame)
cam.CameraSubject = focus
RunService.RenderStepped:connect(function()
--cam.CameraSubject = focus
rocket:Update()
focus.CFrame = rocket.position
print(rocket.position.p)
cam.CFrame = focus.CFrame * CFrame.new(Vector3.new(25,0,0))
end)
|
|
Ethan
New Member
Posts: 2
ROBLOX Username: bigboy77584
|
Post by Ethan on Jun 9, 2017 3:16:56 GMT
oh no... I said "to fast" instead of "too fast." I apologize now grammar Nazis.
|
|
codexjosh
New Member
Posts: 7
ROBLOX Username: CodexJosh
|
Post by codexjosh on Jul 2, 2017 17:32:34 GMT
Why not try feet to studs? You have to think about the ROBLOX sky. It's only about 3000 meters tall if you were to think about it. Try feet, you will have more success.
|
|