- terrainnormal = DoRotation(Object::objects[k]->model.Triangles[whichhit].facenormal, 0, Object::objects[k]->yaw, 0) * -1;
- if (terrainnormal.y > .8)
- freefall = 0;
- bounceness = terrainnormal * findLength(&joints[i].velocity) * (abs(normaldotproduct(joints[i].velocity, terrainnormal)));
- if (findLengthfast(&joints[i].velocity) > findLengthfast(&joints[i].oldvelocity)) {
- bounceness = 0;
- joints[i].velocity = joints[i].oldvelocity;
- }
- if (!Tutorial::active || id == 0)
- if (findLengthfast(&bounceness) > 4000 && breaking) {
- Object::objects[k]->model.MakeDecal(breakdecal, DoRotation(temp - Object::objects[k]->position, 0, -Object::objects[k]->yaw, 0), .4, .5, Random() % 360);
- Sprite::MakeSprite(cloudsprite, joints[i].position * (*scale) + *coords, joints[i].velocity * .06, 1, 1, 1, 4, .2);
- breaking = false;
- camerashake += .6;
-
- emit_sound_at(breaksound2, joints[i].position * (*scale) + *coords);
-
- addEnvSound(*coords, 64);
- }
- if (Object::objects[k]->type == treetrunktype) {
- Object::objects[k]->rotx += joints[i].velocity.x * multiplier * .4;
- Object::objects[k]->roty += joints[i].velocity.z * multiplier * .4;
- Object::objects[k + 1]->rotx += joints[i].velocity.x * multiplier * .4;
- Object::objects[k + 1]->roty += joints[i].velocity.z * multiplier * .4;
- }
- if (!joints[i].locked)
- damage += findLengthfast(&bounceness) / 2500;
- ReflectVector(&joints[i].velocity, &terrainnormal);
- frictionness = abs(normaldotproduct(joints[i].velocity, terrainnormal));
- joints[i].velocity -= bounceness;
- if (1 - friction * frictionness > 0)
- joints[i].velocity *= 1 - friction * frictionness;
- else
- joints[i].velocity = 0;
- if (findLengthfast(&bounceness) > 2500) {
- Normalise(&bounceness);
- bounceness = bounceness * 50;
+ terrainnormal = DoRotation(Object::objects[k]->model.Triangles[whichhit].facenormal, 0, Object::objects[k]->yaw, 0) * -1;
+ if (terrainnormal.y > .8)
+ freefall = 0;
+ bounceness = terrainnormal * findLength(&joints[i].velocity) * (abs(normaldotproduct(joints[i].velocity, terrainnormal)));
+ if (findLengthfast(&joints[i].velocity) > findLengthfast(&joints[i].oldvelocity)) {
+ bounceness = 0;
+ joints[i].velocity = joints[i].oldvelocity;
+ }
+ if (!Tutorial::active || id == 0)
+ if (findLengthfast(&bounceness) > 4000 && breaking) {
+ Object::objects[k]->model.MakeDecal(breakdecal, DoRotation(temp - Object::objects[k]->position, 0, -Object::objects[k]->yaw, 0), .4, .5, Random() % 360);
+ Sprite::MakeSprite(cloudsprite, joints[i].position * (*scale) + *coords, joints[i].velocity * .06, 1, 1, 1, 4, .2);
+ breaking = false;
+ camerashake += .6;
+
+ emit_sound_at(breaksound2, joints[i].position * (*scale) + *coords);
+
+ addEnvSound(*coords, 64);