How to move an entity in circular motion from its current position?

I did write the following code for origin point.

Path.prototype.update = function(dt) {

this.timer += dt;

this.currPos.x = Math.cos(this.timer) * this.width;
this.currPos.z = Math.sin(this.timer) * this.height;
this.currPos.y = 0;



You could simply add the entity as a child to an entity that is at the origin, move it away at some radius and rotate the parent. As parent entity is rotated, the child entity will rotate around it as well.

If you want to manually calculate it, then you are almost doing it right, you need to include radius though. Something like:

const radius = 2;
const center = new pc.Vec2();

const x = radius * Math.cos(this.timer) + center.x;
const z = radius * Math.sin(this.timer) + center.y;

this.entity.setLocalPosition(x, 0, z);