LuaNeko
|
  |
| Joined: 21 Jul 2014 |
| Total Posts: 31 |
|
|
| 06 Aug 2014 10:36 PM |
Hello,
I'm trying to use stravant's module to interpolate between two cframes (http://www.roblox.com/CFrameInterpolator-Module-item?id=161739700), and when I'm trying to do a rotation over 180 degrees, it seems to take the shortest rotation path possible. Is it because of how euler angles are computed? I wonder also if it's possible to make those rotations possible without calling two times this function, or if I must directly use quaternions for that kind of stuff (even though it'll be slower)
Thanks! |
|
|
| Report Abuse |
|
|
| |
|
LuaNeko
|
  |
| Joined: 21 Jul 2014 |
| Total Posts: 31 |
|
| |
|
|
| 07 Aug 2014 05:59 PM |
| I believe Stravant's CFrameInterpolator will always try to take the the shortest path to the goal. So, if you want to rotate by more than 180 degrees you may have to edit the module or use a midpoint for your rotation. For example if you want to rotate 200 degrees you could rotate 100 degrees and then rotate 100 degrees again. |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 07 Aug 2014 06:41 PM |
The module actually uses AxisAngles internally, so if you crack it open you'll easily be able to make it take a path greater than 180 degrees. Right by the end:
-- Return the interpolator return theta, function(t) return c0*fromAxisAngle(rotationAxis, theta*t) + positionDelta*t end
The important part is the "theta*t". If you modify that part you'll be able to get out some other behaviors:
(theta + math.pi*2)*t -> The interpolation will take one extra full turn during it's transit to the goal
(theta - math.pi*2)*t -> The interpolation will take the longer of the two possible rotational paths to the goal rather than the shorter.
|
|
|
| Report Abuse |
|
|