I’m very new to PlayCanvas and I have a question. So sorry if the answer is trival for most of you. But I could not figure it out yet.
I have a entity with a script attached that uses events to write acceleration sensor data to local variables.
This acceleration sensor data is needed by other entities (in the update function).
How can I access the data of the acceleration reading script from other scripts?
Get a reference to the entity object. From that you can get the script component and from that you can get scriptType instance.
So if the script type name is ‘accelerationGyro’, it would be:
Where someProperty are the properties of the script type that you’ve added to the
this object in the script or you can call functions.
You can see this being done in Orbit Camera: Orbit camera | Learn PlayCanvas
Line 19: PlayCanvas | HTML5 Game Engine
How can I set this thread to ‘SOLVED’ ?
You can edit the post title up to some time after the initial post.
If you aren’t able, then a moderator will step in and do it for you.