Skip to content

Instantly share code, notes, and snippets.

@vermie
Created June 30, 2012 02:17
Show Gist options
  • Save vermie/3021844 to your computer and use it in GitHub Desktop.
Save vermie/3021844 to your computer and use it in GitHub Desktop.
linear spline offset
diff --git a/src/game/movement/packet_builder.cpp b/src/game/movement/packet_builder.cpp
index 2e7b4f9..50a93b4 100644
--- a/src/game/movement/packet_builder.cpp
+++ b/src/game/movement/packet_builder.cpp
@@ -99,16 +99,16 @@ namespace Movement
uint32 last_idx = spline.getPointCount() - 3;
const Vector3 * real_path = &spline.getPoint(1);
+ Vector3 dest = real_path[last_idx];
data << last_idx;
- data << real_path[last_idx]; // destination
+ data << dest;
if (last_idx > 1)
{
- Vector3 middle = (real_path[0] + real_path[last_idx]) / 2.f;
Vector3 offset;
// first and last points already appended
for(uint32 i = 1; i < last_idx; ++i)
{
- offset = middle - real_path[i];
+ offset = dest - real_path[i];
data.appendPackXYZ(offset.x, offset.y, offset.z);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment