Hi there!
I followed Scarlet thread's tutorial on Game Object basics.
But I realized that my Car object's physics is stationary when I move the car.
Which implies that my car moves through walls.How do I update the physics so that it moves simultaneously with the car mesh? Thanks in advance.Here is the code.
Code:
class Car : public Game::Obj
{
public:
Vec dir;
Car ::Car();
Car::~Car();
//draw
UInt drawPrepare();
void drawShadow();
void create(Object &obj);
virtual Vec pos ( ){return _matrix.pos;} // get position
virtual void pos (C Vec &pos ){_matrix.pos = pos; _scaled_matrix.pos=pos;}// set position
virtual Matrix matrix ( ){return _matrix;} // get matrix
virtual Matrix matrixScaled( ){return _scaled_matrix;} // get the scale matrix.Not found in Game::Obj
virtual void matrix(C Matrix &matrix){_matrix = matrix; _scaled_matrix = matrix; _scaled_matrix.scaleOrnL(scale);} // set matrix
// get
bool InSpawnRange(Player&chr)
{
return Dist(pos(), chr.pos()) <= 15;
}
// move
void move()
{
// code to move car
}
// update
Bool update(); // update, return false when object wants to be deleted, and true if wants to exist