playMaker

Author Topic: 2D curved movement  (Read 1703 times)

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
2D curved movement
« on: June 05, 2014, 10:33:26 AM »
Hi All, I am trying to make an object go from one vector point to another vector point but I want it to curve to that point.

Like so:

The two points are going to be random so it can't be a set path. From my understanding on other forums it has to do with bezier curves but I can't find anything like this in the actions...

Code: [Select]
CurveX = (((1-BezierTime)*(1-BezierTime)) * StartPointX) + (2 * BezierTime * (1 - BezierTime) * ControlPointX) + ((BezierTime * BezierTime) * EndPointX);
    CurveY = (((1-BezierTime)*(1-BezierTime)) * StartPointY) + (2 * BezierTime * (1 - BezierTime) * ControlPointY) + ((BezierTime * BezierTime) * EndPointY);
    transform.position = Vector3(CurveX, CurveY, 0);

Any help would be most appreciated!
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez