This project is read-only.

Will be there a pivot?

Mar 24, 2013 at 12:25 AM
Edited Mar 24, 2013 at 12:27 AM
Ive modified the UpdateLocal method to get a pivot point for the entities.

Its not performance optimated.
But I think it is possible to make a hierarchy with nodes to get a pivot too. But this is easier to setup for me in this way.

How is the normal way to have a pivot. Transform the Entity inside an actor?

modification for getting a pivot for an entity.
void UpdateLocal( float fTime )
    // Update the controllers that are attached to this entity.
    for ( auto pController : GetParent().m_Controllers )
        pController->Update( fTime );

    // Load the local space matrix with the rotation and translation components.
    if ( m_bCalcLocal )
        /* old
        Matrix4f scale;
        scale.Scale( m_fScale );
        this->m_mLocal.SetRotation( this->m_mRotation );
        this->m_mLocal.SetTranslation( this->m_vTranslation);
        this->m_mLocal = scale * this->m_mLocal;

        Matrix4f rotation;
        rotation.SetRotation( this->m_mRotation );

        Matrix4f translation;
        translation.SetTranslation( this->m_vTranslation);

        Matrix4f scalation;
        scalation.Scale( this->m_fScale );

        Matrix4f pivot;
        pivot.SetTranslation( this->m_vPivot);

        this->m_mLocal = rotation * pivot * scalation * translation;
Mar 24, 2013 at 12:32 AM
Can you clarify what you mean by pivot? I think from your code you mean that you are doing some sort of an offset? In general, the local translation is applied after the rotation, but you have two options to manage this if you want to have another translation:
  1. You can use a customized controller to do the modifications for you.
  2. You can use another node to provide an offset, then attach this entity to that node.
The latter of the two is actually why there is a node and a body (entity) in each Actor class - so that the entity can be moved 'locally' while the node represents the main portion of the actor that is anchored.
Mar 24, 2013 at 12:38 AM
Yes the pivot is an offset.

Ok i will try to make this with nodes. It was easier to handle this like this way. But i know this needs more performance for general purposes.
Mar 24, 2013 at 12:44 AM
You could of course just use a subclass of Entity3D that implements your specialized update local method. Just subclass it and then override the UpdateLocal method! Then you can use whatever customized logic that you want.
Mar 24, 2013 at 2:14 AM
good idea