Unite 3: Lesson 23: Collisions

Hello,

Could someone help me understand the visual and functional differences between the .displace() and .collide() blocks in lesson 23? Visually, they look the same, so my students don’t understand the purpose of having blocks that function similarly.

Thank you.

hello @jarevalo,

from my experience the main difference between the two is how the velocity is calculated after the sprite makes contact mainly the properties velocityX & velocityY prospectively

collision() will halt all velocity being calculated with the target and will be safer to ensure it won’t be clipped (although it’s usually much rougher if you plan on having gravity platforms with collisions so you’d be better off with displace())

displace() will prevent a sprite from moving further but it will not remove the velocity which can lead to clipping collisions (velocities that are too high that the collision never happens) but allows for more control with player velocity control on collisions with different sprites as apposed to collisions

if there’s anything else I am missing feel free to join in

Varrience

Thank you for the explanation. This helps a lot.