Skip to content
Oğuz Eroğlu edited this page Jun 20, 2020 · 6 revisions

Definition

Entity is the basis of Kompute objects. When inserted into a world, entities are consiered as box-shaped obstacles. Note that each steerable is a specific type of an entity.

Usage

// create a World
var world = new Kompute.World(100, 200, 300, 10);

// create an Entity

// Entity is located at (10, 10, 10)
var entityCenterPosition = new Kompute.Vector3D(10, 10, 10);

// A 5x5x5 cube
var entitySize = new Kompute.Vector3D(5, 5, 5);

// This entity has ID: "entity1"
var entity = new Kompute.Entity("entity1", entityCenterPosition, entitySize);

// insert the Entity into the World
world.insertEntity(entity);

// to update the position of the entity
var newPosition = new Kompute.Vector3D(10, 30, 10);
entity.setPosition(newPosition);

// to update the size of the entity
var newSize = new Kompute.Vector3D(10, 10, 10);
entity.setSize(newSize);

// to remove the entity
world.removeEntity(entity);

Clone this wiki locally