-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponse_v1.h
57 lines (47 loc) · 1.32 KB
/
response_v1.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
PHYSISC
author: Paolo Bonomi
Real-Time Graphics Programming's Project - 2019/2020
*/
#pragma once
#include <physics/verlet/verlet_particle_v1.h>
class Response
{
//the id is composed by the id of the rb and the id of the patricle
vector<int> id;
Movable * mov;
vec3 pos;
vec3 old_pos;
public:
Response(vector<int> response_id, Movable * movable, vec3 new_position, vec3 old_position)
{
this->mov = movable;
this->id = response_id;
this->pos = new_position;
this->old_pos = old_position;
}
static vector<int> genId(int rigidbody_id, int particle_id)
{
vector<int> r;
r.push_back(rigidbody_id);
r.push_back(particle_id);
return r;
}
void apply()
{
this->mov->setPosition(this->pos, this->old_pos);
}
vector<int> getId()
{
return this->id;
}
//this need to be review
void update(Response * r) //each response share the same Movable
{
/*
vec3 n = this->pos - this->mov->getPosition();
vec3 v = r->pos - r->mov->getPosition();
this->pos = this->mov->getPosition()+n+v;
*/
}
};