-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrock.cpp
More file actions
29 lines (24 loc) · 691 Bytes
/
Copy pathrock.cpp
File metadata and controls
29 lines (24 loc) · 691 Bytes
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
#include "rock.h"
Rock::Rock(double x,double y,double w,double h):xpos{x},ypos{y},width{w},height{h}
{
}
void Rock::setEnabled(bool v){
enabled = v;
}
cVector3d Rock::getForceFeedback(double x,double y,double t,bool xupdate,bool yupdate){
cVector3d force(0,0,0);
int A = 5;
double f = 100;
if(enabled){
if(x >= xpos && x <= (xpos+height) && y >= ypos && y<= (ypos+width))
{
triggered = true;
if(xupdate || yupdate) force(2) = A*cSinRad(f*t);
if(yupdate) force(1) = A*cSinRad(f*t);
if(xupdate) force(0) = A*cSinRad(f*t);
}else{
triggered = false;
}
}
return force;
}