cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for getter methods for SceneObject's

waynecochran
Explorer

There are a number of "setter methods" for SceneObject, but I am not finding where the corresponding "getter methods" are.

e.g. getName(), getPosition(), getRotation(), isVisible(), etc...

1 REPLY 1

NotBadB
Meta Employee

Hi, we don't provide those getter APIs, however if you used an entity to create your SceneObject by attaching a Mesh component, you can get the Transform and Visible components of that entity to get the values of the SceneObject. Here's an example:

val myEntity = Entity.create(Mesh(Uri.parse("example.glb")), Transform(Pose(Vector3(1f, 2f, 3f))), Visible())

// This will create a SceneObject
// Sometime later (at least one tick)
val mySceneObject = systemManager.findSystem<SceneObjectSystem>().getSceneObject(myEntity)

val myTransform = myEntity.getComponent<Transform>().transform
val myPosition = myTransform.t
val myRotation = myTransform.q

val myVisible =myEntity.getComponent<Visible>()

// example of changing isVisible to false
myVisible.isVisible = false
myEntity.setComponent(myVisible)


Hopefully this answers your question. Let me know if you need any more help