Move object in the direction of the bezier curve?

I have an object with which I would like to follow a bezier curve, and am losing a little now, how to make it do it based on time, not the points that make up the curve.

. :: Current system ::. Each object on my scene graph is made up of position, rotation, and scale vectors. These vectors are used to form the corresponding matrices: scale, rotation, and translation. Which are then multiplied in order to form a local transformation matrix. The world transformation (usually the identity matrix) is then multiplied by the local matrix transformation.

class CObject
{
public:
 // Local transform functions
 Matrix4f GetLocalTransform() const;
 void SetPosition(const Vector3f& pos);
 void SetRotation(const Vector3f& rot);
 void SetScale(const Vector3f& scale);

    // Local transform
    Matrix4f m_local; 
    Vector3f m_localPostion;
    Vector3f m_localRotation; // rotation in degrees (xrot, yrot, zrot)
    Vector3f m_localScale;
}

Matrix4f CObject::GetLocalTransform()
{
    Matrix4f out(Matrix4f::IDENTITY);

    Matrix4f scale(), rotation(), translation();

    scale.SetScale(m_localScale);
    rotation.SetRotationDegrees(m_localRotation);
    translation.SetTranslation(m_localTranslation);

    out = scale * rotation * translation;
}

The big question I have is

1) How to orient my object tangent to the Bezier curve?

2) , ?

void CNodeControllerPieceWise::AnimateNode(CObject* pSpatial, double deltaTime)
{
    // Get object latest pos.
    Vector3f posDelta = pSpatial->GetWorldTransform().GetTranslation();

    // Get postion on curve
    Vector3f pos = curve.GetPosition(m_t);

    // Get tangent of curve
    Vector3f tangent = curve.GetFirstDerivative(m_t);

}

: , . , .

, .

, , , , , .

+5
4

( = ), @etarion.

( , , ), , .

dist = derivative.length()*TIMER_STEP. , , t0 - , t0 epsilon , . , ( t0) . t0

EDIT:

, 3d. , . , - - . .

- . , (, t = 0) . . , . .

, , .

, 3D-.

PS: - ( ) ! http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm

+2

.

, ,

1) ?

, . .

2) ?

, - t . , , "" , .

+2

, , , . . , .

, , ; .

: . , (, , t) . , .

0

One approach is to compute a pyramid of points. The bottom layer is your converted control points. Now for a given t and for each pair of neighboring points, create a new point that is on this segment of the line weighted by t. This new set of points forms the next layer in the pyramid. Repeat until the current layer has only 1 point. This moment is your position. Notice that the second layer on top has 2 points and defines a tangent line.

0
source

All Articles