litalelaJoin Date: 2010-03-30 Post Count: 6267 |
How would I set only 1 part of a Vector3 value? I know I can do +Vector3.new(0,1,0) but I need to do it so that it can change X, Y, or Z.
Would I have to do an if coord == x then elseif coord == y else end
or is there a more efficient way?
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
local old = Vector3.new(69,420,69)
local new = Vector3.new(old.x,69,old.z)
Red Blossoms |
|
litalelaJoin Date: 2010-03-30 Post Count: 6267 |
nono you misunderstood me
I have a value called coord which is "x", "y", or "z"
I have another value which is a number
I need to make a vector value that adds a Vector3 value to another Vector3, but the first vector3 is all 0 except for the coordinate which coord is, and that is the num val.
if that makes any sense
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
litalelaJoin Date: 2010-03-30 Post Count: 6267 |
local coord = "x" -- can be y or z
local v = game.Workspace.Example
function findcoord()
local test = v.Position[coord] + v.Size[coord]
return test
end
function clone()
local cln = script.Parent:Clone()
cln.Parent = game.Workspace
cln.Position = cln.Position = Vector3.new(findcoord(), 0, 0) -- something like this, but that it only sets the value which is what coord is. ik i can do this with conditionals, but that seem sloppy --
end
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
llaserxJoin Date: 2011-12-10 Post Count: 53069 |
|
|
litalelaJoin Date: 2010-03-30 Post Count: 6267 |
lol my bad meant to have +
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
llaserxJoin Date: 2011-12-10 Post Count: 53069 |
|
|
|
So you mean, you want to change a determinated axis?
|
|
litalelaJoin Date: 2010-03-30 Post Count: 6267 |
yes
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
Depends on how you want to edit the brick.
Just do:
local axisX = 0
local axisY = 0
local axisZ = 0
--Script that edits the axis..
Whatever.Vector3 = Vector3.new(axisX,axisY,axisZ) |
|
litalelaJoin Date: 2010-03-30 Post Count: 6267 |
@insane
oh good idea
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|