Hi! I’m trying to test my script, so I added some console.log
calls to update
function. After installing npmdef and opening it on browser, I don’t see any log from my script. Is there any option do I have? Thank you!
by user 909845602358161440
Hi! I’m trying to test my script, so I added some console.log
calls to update
function. After installing npmdef and opening it on browser, I don’t see any log from my script. Is there any option do I have? Thank you!
by user 909845602358161440
Can you try restarting the server?
How can I do this?
by user 909845602358161440
You can hold ALT on ExportInfo to see additional options. Open Server then becomes restart server
Or you can close the commandline window that opened when you clicked play the first time
Or you can click the “X” in the bottom right of Unity where you can see the running processes
Oh, I see. It seems it’s restarting now. Hold on for results.
by user 909845602358161440
Umm, it’s not working too. Maybe this log message would help?
by user 909845602358161440
Did you add the component CameraBlocker to any of your objects in the scene? And are those components/gameObjects active (enabled in Unity)
Yes, sure!
by user 909845602358161440
As you can see, my script is well-structed, and properly installed.
by user 909845602358161440
Just to be sure: the spectatorcamera gameobject is inside a GltfObject ? And not set to EditorOnly ?
Ah its possible that the SpectatorCamera is disabled at runtime
try adding it to another object.
Thanks! I’ll do it.
by user 909845602358161440
Great! It seems working. Thanks a lot! BTW, how can we get “world” position of given gameObject? I’m currently doing like this, but I think it’s not correct one.
this.gameObject.getWorldPosition(new THREE.Vector3())
by user 909845602358161440
there’s a utils function that you can import from needle engine, also named getWorldPosition()
it has a circular buffer of vector3 objects so make sure to not cache them if you just use the return value (you can also pass in your own vector3 like in your example)
theres the same for rotation and scale btw
getWorldRotation
getWorldQuaternion
getWorldScale