Entities - SC-SGS/surviving-sarntal GitHub Wiki

So far, we only discussed convex polygons. The algorithms as described above can be applied to rocks without restriction. The hiker behaves very similarly but with some key differences. The hiker movement is governed by the user input. Gravity is only applied when the hiker is in the air. For collisions, the hiker hitbox is a convex polygon that does not rotate. When a rock hits the hiker, the rock is destroyed and damage is applied to the hiker. Moreover, a knockback impulse based on the rock's impulse is applied to the hiker.

Terrain collisions are also different. In air, the hiker bounces off the terrain like a rock would. On the ground however, the hiker needs to be able to walk smoothly without colliding with the terrain. This is achieved by clamping the hiker on the terrain with a small upward displacement $(0, \epsilon)^T$, so that the hiker only collides with overhangs and walls and not the terrain below. Further checks were implemented e.g., to guarantee that the hiker cannot climb or descend a slope that is too steep.

The most simple entity is the monster or kill bar. Its movement is only characterized by an x coordinate. $$ x_{\text{monster}}^{t+1} = x_{\text{monster}}^{t} + \delta t \cdot v_{\text{monster}}^{t} $$ The texture is always placed on top of the terrain. With the velocity of the monster increasing over time, difficulty is raised. There are no collisions with the monster.

$\rightarrow$ Check out the performance analysis of our physics engine here.

⚠️ **GitHub.com Fallback** ⚠️