VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
lets say I have pointA and pointB (randomized points) and I do this: points = # ######## # ####### - pointA).magnitude the points variable is how many points is going to be inbetween pointA and pointB. now given this information, how would i define those points inbetween pointA and pointB? like if i wanted to position 3 parts on those # ####### how would i do that? these # ###### are perfectly inbetween pointA and pointB |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
guys i cant cope with this. i really cant wrap my head around why roblox would do this injustice to us. pastebin/WG7YdCYd -- the post |
|
LeafDoodeJoin Date: 2017-05-29 Post Count: 3094 |
man what I wanna know is why ROBLOX even made Filtering in this sub forum |
|
MescalyneJoin Date: 2017-04-20 Post Count: 418 |
(pointb - pointa).unit * (distance / points) * I
where I is segment desired where 0 is start and points + 1 is the end |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
that didn't work, it just gets positioned elsewhere. pointa is humanoidrootpart position and pointb is mouse position |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
here is that part of the code
pastebin/fE3spcq9 |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
wait damnit do i have to use rays >.< |
|
MescalyneJoin Date: 2017-04-20 Post Count: 418 |
pointa * ((pointb - pointa).unit * (distance / points) * I)
I apologize, that other one probably would always start at origin |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
like, no problem but i thought this could be done without rays |
|
MescalyneJoin Date: 2017-04-20 Post Count: 418 |
pointa + ((pointb - pointa).unit * (distance / points) * I)
sorry I screwed that last one up too
|
|
MescalyneJoin Date: 2017-04-20 Post Count: 418 |
and by the way no, rays would involve the same exact math as this
|
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
there is another thing i am curious about which i believe might be harder, but for instance: how would i move one of these parts between pointA and pointB to the left, IN ACCORDANCE TO THE LINE between pointA and pointB? |
|
TruSightJoin Date: 2010-11-08 Post Count: 983 |
After you create your points, use lerp() and cframe the part your moving to each of the desired points. OR just have a start and end point and lerp() can do the rest.
|
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
that wasnt what i asked |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
what i mean is, assuming all points have been made with that formula from that poster, now how would i move on of these points to the left by for instance, a stud, in accordance to the line/direction between the origin and end point |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
################ ## ################## ####### |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
one * |
|
MescalyneJoin Date: 2017-04-20 Post Count: 418 |
I really don't know how to explain what you should do for your thing but here's an example of the kind of effect you desire, if I'm understanding it right
(starter character script)
mouse = game.Players.LocalPlayer:GetMouse()
mouse.Button1Down:connect(function()
local hit = mouse.Hit.p
local o = script.Parent.HumanoidRootPart.Position
local halfway = o + (hit - o) / 2;
local pointing_at = CFrame.new(halfway, hit)
local p = Instance.new('Part')
p.CFrame = pointing_at * CFrame.new(Vector3.new(1, 0, 0))
p.Size = Vector3.new(0.2, 0.2, (hit - o).magnitude)
p.Parent = workspace
p.CanCollide = false
p.Anchored = true
end)
"p.CFrame = pointto * CFrame.new(Vector3.new(1, 0, 0))" translates it by (1, 0, 0) in local space. local space is a coordinate system respective to the CFrame's position and orientation
Sorry I couldn't explain this better or provide instructions-- CFrames are a hard topic to teach. |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
i was thinking about that, about getting the direction through that CFrame. but i cant do it because it confuses me, like what does that point-to constructor of CFrame return`? |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
i know what it does, but i have difficulties doing more advanced calculations with it because of what it returns in such a calculation |
|
QuasiduckJoin Date: 2008-09-28 Post Count: 2437 |
What do you mean exactly by to the 'left' of a line?
Left in world coordinates?
Or do you mean that a point is translated from the end point of the line on a perpendicular axis? (Like a disc with a stick going through it, then choosing some point on that disc to be defined as 'to the left' of the line?) |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
i meant left in the local space of the direction of the pointa-pointb |
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
local Point = Origin + (Direction * (PointByPointDistance) * i)
that is the formula, but i cant seem to apply that with CFrame.new(startpoint, lookat) |
|
QuasiduckJoin Date: 2008-09-28 Post Count: 2437 |
That is just one direction though.
To find a single left out of an infinitely possible number of lefts.
You would have to use some other arbitrary direction as your up/ back vector.
I'm just going to pick the global up axis as your second direction which I'll use to find a line perpendicular to your original line.
pastebin /GUnFtYeg
|
|
VoidFrostJoin Date: 2011-10-14 Post Count: 1188 |
no but, how do i apply whatever i want to my formula, since keep in mind, i amcreating # ###### ####### ###### and pointB. so all the points/parts inbetween pointA and pointB are positioned in aa straight line, but how would i take the first part in this line of points, and move it to the left relative to this line? |
|