Rigid Body: setActivationState function

Hey! can anybody tell what the function of Rigid body "setActivationState() does and how can we inactive the rigid body through this function?

Where did you find this function? I can’t see it on the public or private API?

Its a rigid body function used in the creation of ammo bullet. I have seen it in different examples and without this function my rigid body doesn’t work.
Here is an example on line 95
http://jsfiddle.net/strelzoff/CHJes/
I just want to know what exactly this function does so that i can change the state accordingly

PlayCanvas wraps the Ammo library with it’s own API. From the looks of the Bullet examples, it’s tell the physics simulation whether it should be simulated or not.

The physics simulation will put rigid bodies to ‘sleep’ if they haven’t been moved / disturbed for while for performance reasons. You can force it to be active by using https://developer.playcanvas.com/en/api/pc.RigidBodyComponent.html#activate function

Can you post an example of a project that is not working as you think it should as it’s very rare that you should need to change the state directly?

Mainly i want to remove the bullet which was created. Here is a code of creation.Code Highlight
Vehicle.prototype.initialize = function () {
var tr = new Ammo.btTransform();
tr.setIdentity();

var p = this.entity.getPosition();
tr.setOrigin(new Ammo.btVector3(p.x, p.y, p.z)); 
this.carChassis = this.localCreateRigidBody(this.CarMass, tr, compound);
this.carChassis.entity = this.entity;

// Create vehicle
var tuning = new Ammo.btVehicleTuning(); //https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=3346
var vehicleRayCaster = new Ammo.btDefaultVehicleRaycaster(app.systems.rigidbody.dynamicsWorld);
this.vehicle = new Ammo.btRaycastVehicle(tuning, this.carChassis, vehicleRayCaster);

// Never deactivate the vehicle
this.carChassis.setActivationState(pc.RIGIDBODY_DISABLE_DEACTIVATION);
// Add the vehicle to the dynamics world
app.systems.rigidbody.dynamicsWorld.addAction(this.vehicle);

}
Vehicle.prototype.removeRigidBody = function () {
this.app.systems.rigidbody.dynamicsWorld.removeRigidBody(this.carChassis);
//this.app.systems.rigidbody.dynamicsWorld.removeAction(this.vehicle);
this.app.systems.rigidbody.dynamicsWorld.removeVehicle(this.vehicle);

playerEntity.destroy();

}Code Highlight

So here is a code of creation in initiliaze function and destroy in removeRigidBody Function. but deletion code is not working for me. that is why i was asking if setActivationState() has to do anything with the destruction or not