Example

Vector Terrain + Vector Collision

8

SP4CEBAR 2023-01-30 17:17 (Edited)

Based on

Predecessor of collision:


SP4CEBAR 2023-01-30 19:31

Update:
- full vector collision: before it would be activated by a cell collision


SP4CEBAR 2023-01-30 19:41

Update 2:
- added an 8-pixel offset to make the ball collide at the right height
- set the number of balls to 1 (apparently physics would loop for 16 objects each frame, even though there only needs to be one)


SP4CEBAR 2023-01-30 19:44 (Edited)

The vector collision is still far from perfect:
- at the hill tops it sometimes tops to the left too easily
- it sometimes goes underground after rolling downhill


SP4CEBAR 2023-01-30 21:04

Update:
- it will now recover immediately if it happens to go underground


SP4CEBAR 2023-01-31 09:00 (Edited)

Update
- added a stronger recovery system because it would still go underground (the distance underground is added to the position putting it in the right place immediately)

It looks like the collision goes out of sync or something


SP4CEBAR 2023-01-31 13:40

Update:
- the velocity vector allignment shouldn't go out of sync anymore


SP4CEBAR 2023-02-02 13:50 (Edited)

the correction system adds energy out of nowhere, which makes climbing hills sometimes easier than it should be, as well as making rolling down-hill harder, but without it, the ball too often falls in between the collision system (the collision system prevents the velocity vector from having a component going in a certain direction, that being into the ground, but the vector segments for each terrain unit (8 pixels wide) may not fit onto each other that well)


Pablo 2023-02-12 04:34 (Edited)

This is great, will be very useful.


SP4CEBAR 2023-02-12 11:07

Thank you!


Log in to reply.