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
 

Re: Move and object from 1 position to another w/ parabola

Previous Thread :: Next Thread 
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
12 Apr 2016 05:04 PM
How would I make it so that, using CFrame, I could move an object from pos1 to pos2 using a quadratic equation?


Instance.new("BodyThrust",SenseiWarrior).position = CFrame.new(SenseiWarrior,YourGirlsDMs)
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
12 Apr 2016 05:05 PM
do u mean like move it in a curve?
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
12 Apr 2016 05:06 PM
thats what a parabola is yes


Instance.new("BodyThrust",SenseiWarrior).position = CFrame.new(SenseiWarrior,YourGirlsDMs)
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
12 Apr 2016 05:08 PM
ya but like a parabola is like a 2d thing

which way would the object curve in 3d space? would it curve up? down? left? right?
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
12 Apr 2016 05:10 PM
up


Instance.new("BodyThrust",SenseiWarrior).position = CFrame.new(SenseiWarrior,YourGirlsDMs)
Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
12 Apr 2016 05:17 PM
Well I think it would still be possible by CFraming ,but it would be ugly. Because eventhough we are programming in a 3d world we can use 2D for the CFraming by only using like for example the Position x and y or z and y etc.
Report Abuse
Void_Optics is not online. Void_Optics
Joined: 21 Mar 2016
Total Posts: 286
12 Apr 2016 05:18 PM
I would try getting some points then lerping/interpolating
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
12 Apr 2016 05:18 PM
then i would just add y coordinates to a normal cframe tweening function

and u could use the parabolic equation to figure out how high the y
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
12 Apr 2016 05:20 PM
Interpolate to find the vertex. Then use a rays to connect the vertex to the 2 endpoints.
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
12 Apr 2016 05:27 PM
Oh I did not know you mentioned you wanted to 'move' the object if that's the case discard my idea about the Rays and instead move the part towards the vertex. The vertex would be determined by using a function I cannot remember but it takes in two points the parabola passes through which in this case would be pos1 and pos2 and will output the vertex from there you will move your part from pos1 to vertex and vertex to pos2.
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
12 Apr 2016 05:33 PM
nvm after searching it's not mathematically possible given two points. Because if all you're given is two there are infinitely many parabolas that pass through those two points.
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
12 Apr 2016 05:44 PM
local pos1 = Vector3.new(x1, y1, z1)
local pos2 = Vector3.new(x2, y2, z2)
local offset = pos2 - pos1
local dx, dy, dz = offset.X, offset.Y, offset.Z
local height = 10

local midpt = pos1:Lerp(pos2, 0.5)
local vertex = Vector3.new(midpt.x, dy+height, midpt.z)

So each y point would be: -height*(x-vertex.X)^2 + vertex.Y
Hopefully I did that correctly
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
12 Apr 2016 05:52 PM
Never again.
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
12 Apr 2016 05:54 PM
There may be infinite many parabolas, but there will only be 1 that has that height :)
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
12 Apr 2016 05:56 PM
One has that vertex*
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
12 Apr 2016 06:07 PM
local part, origin, a, b, c, x, y = Instance.new("Part",workspace),
Vector3.new(0,0,0),
1, --ax^2
1, --+bx
0 --+c

y = function(x)return (a*x^2)+b*x+c end

for i=-10,10 do
part.Position = Vector3.new(x,1,y(x))+Origin
wait(.1)
end


Perhaps?
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
12 Apr 2016 06:26 PM
@Flux yeah I completely forgot about defining one's own vertex.
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