Double coding help

I have 2 things I need help with

  1. Turning on and off scripts from a separate script
  2. Freezing an entity in place so you apply tons of force and blast off

if anyone can help with one or both of these I’m all ears
Sincerely William Boersma

Hi William!

First of all, make sure to read the documentation about the pc.Entity:

There you can learn all the properties and methods you can access from any entity in your game.

  1. I can think of two ways of doing so:
otherEntity.script.enabled = false;
//Disable the pc.ScriptComponent of "otherEntity".

 otherEntity.script.scripts[index].enabled = false;
//Disable a specific script
  1. What do you mean exactly with “blast off”? are you trying to collide with that entity?
    if so, you just need to add Rigidbody and Collision component to that entity. Make sure to set the Rigidbody type to “static”.
1 Like

I think you also need to define an object where the script is attached on in initialize.


this.ObjectWithScript ='ObjectWithScriptAttached');

and use this.ObjectWithScript.script.enabled = false; in specific part of code you want

I used finding by name, but you can also find object by tag or with other methods you can see in documentation.

The way of freezing entities is to set = 0;

but to freeze one entity it depends whether you using physics or just translate method.

Hi @Francisco_Bozzo I got the freezing but the turning on and off scripts still doesn’t work.

never Mind I got it

1 Like