Exemplo n.º 1
0
gob::gob(const tcomp& newPos, const tcomp& newVel, gob *newParent)
  : pos(newPos),
    vel(newVel),
    parent(newParent),
    solid(classSolid),
    lastPosAng(pos.Ang()+ang3d(1,1,1))
{
  vel.Scale()= pt3d(0,0,0);
  UpdateWorldPos();
}
Exemplo n.º 2
0
void Arrow::Tick(float deltaTime)
{
    Super::Tick(deltaTime);
    UpdateWorldPos();
    
    Vector3 shippos = mPlayer->GetPosition();
    Vector3 checkpos = mCheckpointPos;
    Vector3 direction = checkpos - shippos;
    direction.Normalize();
    if( direction.x == 1 && direction.y == 0 && direction.z == 0)
    {
        SetRotation(Quaternion::Identity);
    }
    else
    {
        Vector3 axis = Cross(Vector3::UnitX,direction);
        float angle = Math::Acos(Dot(Vector3::UnitX,direction));
        axis.Normalize();
        Quaternion rotation(axis, angle);
        SetRotation(rotation);
        
    }
}
Exemplo n.º 3
0
/* Make this gob "act" for one game iteration.  "Acting" typically includes
   one or more of the following:

   o  morphing the gob (changing its shape or class)
   o  setting the gob's velocity
   o  moving the gob
   o  interacting with other gobs

   Act() returns:

   o  NULL, if the gob is destroyed,
   o  a ptr to a new gob, if the gob becomes a different object (as in the
      tank to helicopter transformation), or
   o  the "this" ptr, otherwise
*/
gob* gob::Act() {
  vel.Scale()= pt3d(0,0,0);  // for right now... -PAH
  pos += vel;
  UpdateWorldPos();
  return this;
}
Exemplo n.º 4
0
void Arrow::BeginPlay()
{
    UpdateWorldPos();
}