`.GetOrigin` function not working at all

Summary

.GetOrigin just fails everytime even when the entity it’s being called on has a transform component

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

  1. Create an entity with a transform component and place it in the world
  2. Create, compile and add the component below to the entity
  3. Read the print log

origin_tester_component

origin_tester_component<public> := class<final_super>(component):
    OnSimulate<override>()<suspends>:void=
        Entity.SetGlobalTransform(transform{}) # Will add a transform component if one doesn't exist
        if(Entity.GetOrigin[]) then Print("Got Entity's origin") else Print("Entity has no transform_component")

Expected Result

The printed statement should say “Got Entity’s origin”

Observed Result

But it’ll say “Entity has no transform_component” despite one existing

Platform(s)

PC

Your assumption is incorrect. It is working as expected:
Entity Origin is ?origin, this mean, it can exist, or can be false…

  • When entity has no origin, the local transform defaults to parent entity;

  • When entity has an origin, the local transform will default to that origin;

In your example, you are calling GetOrigin[] on a entity that has no origin, that’s why it is failing. It has nothing to do with transform_component existing or not.
In fact, every entity gets a transform component automatically when being added to scene (You don’t even need to call the SetTransform).

You can set a origin using .SetOrigin(NewOrigin), and can reset it (make it blank) by using .ResetOrigin(). Can also do that directly on the mesh component if you have direct access to it.

2 Likes