Skip to content

Physics Engine

ilovethisid edited this page Jun 8, 2021 · 2 revisions

Rigidbody

What is rigidbody?

Rigidbody is a component in object which enables the object to act under the control of physics.

Component :

  1. Collider Collider enables users to check collision and make movement regarding collision. There are two types of collider, which are box collider and matrix collider. Box collider is a rectangular shaped collider, and matrix collider is a collider made of matrix. Matrix collider has matrix with 0s and 1s, 0 meaning empty and 1 meaning filled. Function in Rigidbody checkCollision(object) returns value meaning the type of collision. 0 is for no collision, 1 is intact(their distance is 0), and 2 is for overlap(they overlap).

  2. Velocity Velocity is represented as a vector. Vector has x and y component, and each stands for x axis velocity and y axis velocity. Standard object movement is performed according to their current velocity.

Rigidbody Members

Phy_Vector velocity

int x,y

Collider* collider

Rigidbody Functions

void makeBoxCollider(args)

void makeMatrixCollider(args)

void setVelocity(velocity)

void move()

int checkCollision(Object&) - check collision with other object