Product: Tetris2P AI
Sprint Summary

Daily Objectives

Notes

Let’s set up daily goals today: I’m at a cafe right now, and it might close soon lmao Where did I leave off from yesterday? I finished adding in the position anchors, adding canvas position and world position variables. When I want to do collision detection, I want to make sure I’m using the canvas positions instead of anchor positions. I’m putting off the right and scroll wheel clicks for now. When I want to make the ‘physics’ engine how do I want to test it and stuff?

A minimum viable example would be placing a player square on a floor, and then getting hit when it touches an enemy object. Before that, I can have the bouncing ball touch and settle on a different objects.

Should I introduce a physics layer? How would I describe what that is? It’s more of a list of objects in a physics space, and applying certain rules to the physics space? I think a good place to do a bit of research is check how you’d make a bouncing ball in unity2d.

Looking up tutorials on how to make physics objects in Unity2D.

Notes from: video:

Required Components:

Colliders interact with other colliders! Having a collider lets you check for collisions with other colliders.
A rigid body adds ‘physics’ forces and updates to an object.
So colliders determine what happens on collision, but rigid bodies determine what happens on each update loop.

next video: video

Misc videos: brackeys

https://answers.unity.com/questions/42558/whats-the-difference-between-a-rigid-body-and-a-co.html

Having a boxCollider with the ‘isTrigger’ checkmarked, will have OnTriggerEnter, Stay, Exit. If you have the ‘isTrigger’ set to true, the collider will no longer behave as a physics object. sIC cOoL, mAkeS sEnSE.

So what’s on the to do now that I’ve figured it out at 3:08 am.

I have to decide whether or not to check for collisions before or after the update loop. Should I just add collision to an event list? Or should I actually have them trigger ‘onCollisionEnter’ and ‘onCollisionExit’ functions when they’re detected?

Now I have to figure out whether I want to add rigidbodies or not. Rigidbodies just add simulated ‘gravity’ and ‘friction’ to an object.
What are the types of things again?

  1. ColliderTriggers
  2. ColliderPhysics
  3. RigidBodies

RigidBodies and ColliderPhysics both cannot overlap, except gravity only applies to RigidBodies. ColliderPhysics object is mostly used for objects such as the ground or floating platforms. I think I should combine the two objects for my project, and the developer can write in their own physics update stuff. The basic rule is that ‘RigidBodies’ cannot overlap. If an object tries to overlap with another object, the movement is prevented. Gravity and forces can be simulated in the ‘update’ function of a game object. Should the developer be aware of these kind of things?
Note-ing down: the physics should be correct before the draw portion of the update loop. Maybe I should implement a cast function, for the developer to use. The cast function is used to check if moving an object into a certain position would be legal. So the developer would use the cast function to check if movement is legal. If not, adjust the new position or run a collision function. Since only one object is being checked at one time, I don’t think there’ll be any synchronization issues? AKA, two objects moving towards each other: first object moves into second object and runs collider function, and then second object runs into first object and runs a second collider function. Hmm, I guess that could be an issue. We can have the first object let the second object know a collider was already detected. This is getting weird because are we assuming any collisions are already detected before the update loop, or will collisions be detected during the updated loop.
Let’s redo the example. Player A checks if moving towards a monster will collide. Cast function returns yes, so Player A executes pseudo-on-collision function. On the same update loop, monster tries to move towards player, and detects the collision. In this case there’s work arounds, like the monster not checking for collisions. BUT, I think the Player A can add itself to the monster’s ‘handledCollisions’ list, for an update loop.

Casting Movements is a way to check for collisions before a movement. BUT, for ColliderTriggers, I should figure out if I want them checked before the update loop or during the update loop.
Example:

if this.floorCollider.checkCollisions( [ list of objects to check with or layer ] ) {
	this.grounded = true;
} else {
	This.grounded = false;
}

checkCollisions return statement can be a list of collided objects + collision orientations.

Objectives Completed