Some screenshots from the debug display (even Chuck got onto the picture



Any help is very welcome

Code: Select all
// parameter is the position of the start of the skid mark
const core::vector3df pos1;
// parameter is the position at the end of the skid mark
const core::vector3df pos2;
// parameter is the normalized normal of the plane the skid mark is on
const core::vector3df normal;
// parameter is the width scale factor to apply to each decal
const f32 width;
// direction of the skid
core::vector3df direction(pos2 - pos1);
direction.normalize();
// vector from pos1 to side of decal
core::vector3df side = normal.crossProduct(direction);
// scale the width vector to make decal wider/narrower
side *= width;
// you could set A and B to be the last to coordinates of the previous skid mark section.
// that would avoid splitting or overlap when a skid section is rotated. it also complicates the code a little.
const core::vector3df A = pos1 - side;
const core::vector3df B = pos1 + side;
const core::vector3df C = pos2 + side;
const core::vector3df D = pos2 - side;
const video::SColor color(255, 255, 255, 255);
Vertices[0] = video::S3DVertex(A.X, A.Y, A.Z, normal.X, normal.Y, normal.Z, color, 0.f, 1.f);
Vertices[1] = video::S3DVertex(B.X, B.Y, B.Z, normal.X, normal.Y, normal.Z, color, 1.f, 1.f);
Vertices[2] = video::S3DVertex(C.X, C.Y, C.Z, normal.X, normal.Y, normal.Z, color, 1.f, 0.f);
Vertices[3] = video::S3DVertex(D.X, D.Y, D.Z, normal.X, normal.Y, normal.Z, color, 0.f, 0.f);
Code: Select all
RibbonTrailSceneNode* skid = new RibbonTrailSceneNode(iDevice, sManager->getRootSceneNode());
skid->setMaterialTexture(0, vDriver->getTexture("textures/skid.jpg"));
skid->setPoint1(core::vector3df(5, 0, 0));
skid->setPoint2(core::vector3df(-5, 0, 0));
skid->setMaxDistance(3);
skid->setStartingAlpha(0);
skid->setShowDebug(true);
skid->setEnabled(true);
Code: Select all
skid->setStartingAlpha(0);