mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-23 20:59:58 +01:00
Add collisions to city
This commit is contained in:
parent
e91467a869
commit
d7f0804248
1 changed files with 14 additions and 1 deletions
|
@ -258,7 +258,19 @@ int main()
|
|||
{
|
||||
if (coll == 1)
|
||||
{
|
||||
models[1].transform.translation = previousPos;
|
||||
S3L_Vec4 newPos = models[1].transform.translation;
|
||||
newPos.x = previousPos.x;
|
||||
|
||||
if (collision(newPos))
|
||||
{
|
||||
newPos = models[1].transform.translation;
|
||||
newPos.z = previousPos.z;
|
||||
|
||||
if (collision(newPos))
|
||||
newPos = previousPos;
|
||||
}
|
||||
|
||||
models[1].transform.translation = newPos;
|
||||
}
|
||||
else if (coll == 2)
|
||||
{
|
||||
|
@ -272,6 +284,7 @@ int main()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
scene.camera.transform.translation.x = scene.models[1].transform.translation.x - carDirection.x;
|
||||
scene.camera.transform.translation.y = S3L_FRACTIONS_PER_UNIT / 2;
|
||||
scene.camera.transform.translation.z = scene.models[1].transform.translation.z - carDirection.z;
|
||||
|
|
Loading…
Reference in a new issue