generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Graphing quadratic functions on ROBLOX

Previous Thread :: Next Thread 
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 Aug 2013 01:58 PM
Has anyone thought to do this?

You could give an input of the smallest number, the largest number, and the equation and a function would create a graph out of parts.

;o
Report Abuse
soupsoupsoup3 is not online. soupsoupsoup3
Joined: 31 Jul 2013
Total Posts: 219
28 Aug 2013 02:10 PM
look it up in free models

it's been done
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
28 Aug 2013 02:11 PM
My brain is struggling to comprehend the question. The only conclusions I can come up with make it so simple it almost does not need asking :|
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
28 Aug 2013 02:30 PM
I've made one once. It also "angled" the parts by doing the *bad* way of making derivatives (by getting it via f(interval+1) - f(interval))

It's not that hard tough, but it creates some fun things. Lemme see if I got a picture of it somewhere..
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
28 Aug 2013 03:09 PM
[ Content Deleted ]
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 Aug 2013 04:20 PM
@Oysi
I am talking about getting parts to connect the dots. It would be too easy if we were just making dots.
Report Abuse
soupsoupsoup3 is not online. soupsoupsoup3
Joined: 31 Jul 2013
Total Posts: 219
28 Aug 2013 04:30 PM
local dist = (part1.Position-part2.Position).magnitude
CFrame.new(0,dist,0)*CFrame.Angles(?)

Maybe
Report Abuse
soupsoupsoup3 is not online. soupsoupsoup3
Joined: 31 Jul 2013
Total Posts: 219
28 Aug 2013 04:31 PM
CFrame.new(0,part1*(dist/2),0)
Report Abuse
soupsoupsoup3 is not online. soupsoupsoup3
Joined: 31 Jul 2013
Total Posts: 219
28 Aug 2013 04:31 PM
part1.CFrame * CFrame.new(0,dist/2,0)

correction
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
28 Aug 2013 04:36 PM
Are you kidding me?
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
28 Aug 2013 05:09 PM
Bro, do you even ROBLOX properly?

~ Linguam latinam est optimum ~
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 Aug 2013 05:09 PM
Sorry, I am not good with angles.

It just seems like something of interest to me.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 Aug 2013 05:10 PM
Oh, you're talking to soup.

Well, my previous statement still applies.

Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
28 Aug 2013 05:13 PM
Do you even Vector3::Lerp()?

~ Linguam latinam est optimum ~
Report Abuse
soupsoupsoup3 is not online. soupsoupsoup3
Joined: 31 Jul 2013
Total Posts: 219
28 Aug 2013 05:13 PM
My older posts were rubbish. I actually tested this one, and it works as long as the points keep the X-Y format (it won't work properly if you try adding the Z dimension).

local part1 = workspace.Part1 --first point

local part2 = workspace.Part2 --second point

local mid = Instance.new("Part",game.Workspace)
mid.Anchored = true
mid.FormFactor = Enum.FormFactor.Custom
mid.Size = Vector3.new(math.floor(((part1.Position-part2.Position).magnitude)+0.05)--[[Nearest tenth]],0,0)
mid.CFrame = CFrame.new((part1.Position.X+part2.Position.X)/2,(part1.Position.Y+part2.Position.Y)/2,part1.Position.Z)*CFrame.Angles(0,0,math.atan((part1.Position.Y-part2.Position.Y)/(part1.Position.X-part2.Position.X)))
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
28 Aug 2013 05:27 PM
distance = (previousPoint-nextPoint).magnitude
connectingPart.Size = Vector3.new(0.2,0.2,distance)
connectingPart.CFrame = CFrame.new(previousPoint,nextPoint)*CFrame.new(0,0,distance/2)

I'm not sure I see the difficulty here.

~ Oh, I'm sorry, did I break your concentration? ~
Report Abuse
jacob2233 is not online. jacob2233
Joined: 23 Aug 2007
Total Posts: 723
28 Aug 2013 05:29 PM
Modification of another script I had; this lets you use type a function as a string and graph it using parts:

function f(a,d) --f(x) notation for lua
x = a --loadstring requires non-local variables
return loadstring("return " ..d)()
end

abs = math.abs --Quick enum
--a = min, b = max, fx = function as string, n = number of blocks to use
function graph(a,b,fx,n)
sum = (abs(a)+abs(b))
if not n or n == 0 then
n = sum
end

m = Instance.new("Model",workspace)
m.Name = "Graph"
for x=a,b,sum/n do
y = f(x,fx)
p = Instance.new("Part",m)
p.Name = "x: "..x.." y: "..y
p.Size = Vector3.new(1,1,1)
p.CFrame = CFrame.new(x,y,0)
p.Anchored = true
end
end

--graph(-7,7.1,"7*math.sqrt(1-(x/7)^2)",400) --Top-half of a circle
--graph(-7,7.1,"-7*math.sqrt(1-(x/7)^2)",400) --Bottom-half of a circle
graph(-10,10,"x^2",500) --basic quadriatic function
Report Abuse
toshir0z is not online. toshir0z
Joined: 03 Nov 2009
Total Posts: 425
28 Aug 2013 05:51 PM
Pos1 = Vector3.new(0,0,0)
Pos2 = Vector3.new(0,0,7)
Mag = (Pos1-Pos2).magnitude
Part.Size = Vector3.new(1,1,Mag)
Part.CFrame = CFrame.new(Pos1,Pos2)*CFrame.new(0,0,Mag/2)
--Not tested so eh :3
Report Abuse
soupsoupsoup3 is not online. soupsoupsoup3
Joined: 31 Jul 2013
Total Posts: 219
28 Aug 2013 05:55 PM
Also I don't see you posting anything Absolute so maybe you should not be so quick to judge? If I could edit my post it wouldn't seem like such a mess.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
29 Aug 2013 07:00 AM
@BlueTaslem
That's quite interesting...

Has anyone else done this before?


@Others saying CFrame is easy
I just don't get the CFrame matrix very well, but am quickly learning.

It's not my strong suit. :P
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
29 Aug 2013 07:07 AM
@MHebes
Lol, your script won't work correctly.

Let me correct it for you:


distance = (previousPoint-nextPoint).magnitude
connectingPart.Size = Vector3.new(0.2,0.2,distance)
connectingPart.CFrame = CFrame.new(previousPoint,nextPoint)*CFrame.new(0,0,distance - (distance * 1.5))
Report Abuse
soupsoupsoup3 is not online. soupsoupsoup3
Joined: 31 Jul 2013
Total Posts: 219
29 Aug 2013 11:05 AM
The simplified version of that would be:

connectingPart.CFrame = CFrame.new(previousPoint.Position,nextPoint.Position)*CFrame.new(0,0,-distance/2)

since distance-(distance*1.5) is the same as 1d-1.5d is the same as -0.5d or d/2
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image