How do I disable an object in a subclass from moving with its parent

I’m working on a racing game right now and I’m almost done but I have a little bit of a problem here and I think the car is spinning around and its parent the next camera is not spinning with the car

Hi @dsl188199 and welcome,

There isn’t any method or property to lock an entity from moving when its parent entity moves.

I see two ways to do this:

  1. If it doesn’t break your hierarchy then change the entity parent while it remains locked:
myEntity.reparent(this.app.root);
  1. Override the position per frame to the locked one (this will work for rotation and scale in the same manner):
MyScript.prototype.update = function(){
   myEntity.setPosition(lockedPosVec);
};

I am really sorry for replying to you so late. I have already done it. I have achieved the same result in another way

1 Like