-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathanimation.cpp
More file actions
32 lines (30 loc) · 751 Bytes
/
Copy pathanimation.cpp
File metadata and controls
32 lines (30 loc) · 751 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
30
31
32
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <glm/gtc/noise.hpp>
#include "helper.h"
#include "world.h"
#include "global.h"
#include "camera.h"
#include "bullet.h"
#include "tour.h"
using namespace std;
using namespace glm;
void animation(double time)
{
time = time / 2.f;
float i = 0.f;
for (const pair<string, object_t> &objpair: objects) {
const object_t &obj = objpair.second;
if (!obj.rigidBody || !obj.animation)
continue;
float x = perlin(vec2(i + time, i + time + 2.f));
float z = perlin(vec2(i + time + 3.f, i + time + 4.f));
obj.rigidBody->activate(true);
obj.rigidBody->applyImpulse(btVector3(x, 0.f, z) * 30.f,
btVector3(0.f, 0.f, -0.2f));
i++;
}
}