Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bullet.h"
- SnModel * bullet::bullet_model = new SnModel;
- std::vector<bullet *> bullet::bullet_list;
- bullet::bullet(GsVec position, GsVec direction, bool parent)
- {
- this->direction = direction - position;
- this->position = position + GsVec(0, 1.7f, 0);
- //this->position += GsVec(this->direction.x, 0.0f, this->direction.z) * 7.0f;
- this->position += this->direction * 7.0f;
- if (parent) {
- bullet_model = new SnModel;
- bullet_model->model()->load_obj("../bullet.obj");
- bullet_manip = new SnManipulator;
- bullet_manip->visible(false);
- bullet_manip->child(bullet_model);
- m.scaling(.00000001f);
- bullet_manip->initial_mat(m);
- age = 500000;
- }
- else {
- age = 0;
- bullet_manip = new SnManipulator;
- bullet_manip->visible(false);
- bullet_manip->child(bullet_model);
- bullet_list.push_back(this);
- }
- }
- void bullet::update() {
- position += direction * BULLET_SPEED;
- age++;
- m.rot(GsVec(0, 0, 1), direction);
- m.lcombtrans(position);
- bullet_manip->initial_mat(m);
- }
- void bullet::setAge(int new_age) {
- age = new_age;
- }
- int bullet::getAge() {
- return age;
- }
- GsVec bullet::getPos() {
- return position;
- }
- SnManipulator * bullet::getManip() {
- return bullet_manip;
- }
- const std::vector<bullet *> bullet::getList() {
- return bullet_list;
- }
- void bullet::setList(std::vector<bullet *> list) {
- bullet_list = list;
- }
- bullet::~bullet()
- {
- }
Add Comment
Please, Sign In to add comment