I want to know how I would basically make the Fizzler from Portal. (It destroys certain objects when they go through.)
Hi.
All you need is add masks; colllision groups to the rigidbody … https://launch.playcanvas.com/583817?debug=true
I don’t exactly understand what you mean. That doesn’t seem like it would destroy objects
You could make a script for entities with a rigid body to destroy themselves when collapsing. Something similar to this: … prototype.update; … onCollision this.entity.enabled = false;
Your script kind of breaks my entire game.
So, I tried making my own script for this. And it does absolutely nothing.
// initialize code called once per entity
Fizzle.prototype.initialize = function() {
};
Fizzle.prototype.fizzle = function(result) {
entity.rigidbody.applyTorque(0, 10, 0);
entity.collision.enable();
};
// swap method called for script hot-reloading
// inherit your script state here
// Fizzle.prototype.swap = function(old) { };
// to learn more about script anatomy, please read:
// http://developer.playcanvas.com/en/user-manual/scripting/```
___________________________________________________________________
var FizzlerCheck = pc.createScript('fizzlerCheck');
// initialize code called once per entity
FizzlerCheck.prototype.initialize = function() {
};
FizzlerCheck.prototype.onTriggerEnter = function (otherEntity) {
// it is not teleportable
if (result.other.rigidbody)
if (otherEntity.script.fizzle)
return;
otherEntity.script.fizzler_check.fizzle(this.entity, this.target);
};
// swap method called for script hot-reloading
// inherit your script state here
// FizzlerCheck.prototype.swap = function(old) { };
// to learn more about script anatomy, please read:
// http://developer.playcanvas.com/en/user-manual/scripting/```
What might be easier is to use the Entity tags. For example, the trigger can check the tags of the entities that pass through and if they match ‘power-up’ for example, they get destroyed by the trigger.