Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with basic Roblox rocket and CFrames?

Asked by 6 years ago
local dir = vTarget - vHandle.Position

    dir = computeDirection(dir)

    local missile = Rocket:clone()

    local pos = vHandle.Position + (dir * 5)



    --missile.Position = pos
    missile.CFrame = CFrame.new(pos,  pos + dir)

This is code from the basic Roblox rocket. I understand most of how the rocket works, but this part has me lost. Can someone please explain what is going on in this chunk of code in English. For example, I don't know why they put "v" in front of Handle and Target. Why does the CFrame on the last line only have pos and pos + dir in the parenthesis - shouldn't there be three terms for the vector? Im just really stumped with this part of the code and I can't find anything explaining it.

1 answer

Log in to vote
0
Answered by 6 years ago

They are using their variable. Variables can be any name, like

sdfghujdrokfg = "hello"
dfdjcvhjdif93ews = "i am a variable"

One of their variables are vHandle, so they are using that variable.

Hope this helps!

0
Well I'm still not sure about the CFrames, but I changed the variables around to my own parts and everything is working. Thx for explaining the variables. :) tygerupercut3 68 — 6y
Ad

Answer this question