- vec3 our_center = get_center(our_instance);
- vec3 other_cp = other->closest_point(our_center, other_instance);
- /* Now figure out what shape the other object is! */
- /* If we could get a normal vector for the surface we hit... */
- bool rx = true, ry = true, rz = true;
- if(fabs(other_cp.x - our_center.x) < 0.01)
- rx = false;
- if(fabs(other_cp.y - our_center.y) < 0.01)
- ry = false;
- if(fabs(other_cp.z - our_center.z) < 0.01)
- rz = false;
-
- if(rx)
- velocities[our_instance] *= vec3(-1, 1, 1);
- if(ry)
- velocities[our_instance] *= vec3(1, -1, 1);
- if(rz)
- velocities[our_instance] *= vec3(1, 1, -1);
-
- /* Might not need this - applies one timestep of movement to make sure this projectile
- * isn't in contact with the wall anymore so it won't bounce right back */
- models[our_instance] = translate(models[our_instance], velocities[our_instance]);
+ if(bounce){
+ vec3 our_center = get_center(our_instance);
+ vec3 other_cp = other->closest_point(our_center, other_instance);
+ /* Now figure out what shape the other object is! */
+ /* If we could get a normal vector for the surface we hit... */
+ bool rx = true, ry = true, rz = true;
+ if(fabs(other_cp.x - our_center.x) < 0.01)
+ rx = false;
+ if(fabs(other_cp.y - our_center.y) < 0.01)
+ ry = false;
+ if(fabs(other_cp.z - our_center.z) < 0.01)
+ rz = false;
+
+ if(rx)
+ velocities[our_instance] *= vec3(-1, 1, 1);
+ if(ry)
+ velocities[our_instance] *= vec3(1, -1, 1);
+ if(rz)
+ velocities[our_instance] *= vec3(1, 1, -1);
+
+ /* Might not need this - applies one timestep of movement to make sure this projectile
+ * isn't in contact with the wall anymore so it won't bounce right back */
+ models[our_instance] = translate(models[our_instance], velocities[our_instance]);
+ } else {
+ /* TODO: To properly stick, we should make sure we're not kinda partly inside */
+ velocities[our_instance] = vec3(0, 0, 0);
+ }