Any good tutorials on g3d?

72 views
Skip to first unread message

Tomáš Melichar

unread,
May 15, 2022, 12:33:47 PM5/15/22
to G3D Users
After going through downloading and compiling I found out I dont know as much about g3d as I thought, so I need some help understanding it. I have checked out the sample projects, but they didnt help enough. For example what I wanted to do the first time I got Visual studio working was: moving the camera, I tried:
activeCamera().get()->setPosition(G3D::Point3(Vector3(camx, camy, camz)));
does nothing, I also tried looking through the documentation, didnt find anything.
Any nice place to get tutorials?

Julien Matthey

unread,
May 16, 2022, 5:35:40 AM5/16/22
to G3D Users
The samples *are* the tutorials, and there's nowhere on the net I found more tutorials (+the samples are very good actually).

Are you sure you `->setPosition()` in the sample project you are actually running ? It works just fine for me. Try adding your code at the end of `onInit()` because your active camera might be switched later or some cameras might not be initialized yet where you added your call.

Also you can select the DebugCamera in the SceneEditor window and then move it around with WASD and mouse (hold mouse right button down).

debug-camera.png

Tomáš Melichar

unread,
May 16, 2022, 8:38:07 AM5/16/22
to G3D Users
Hello. Yes I know about the debug camera and that you can move it, but I still havent figured out the ' activeCamera().get()->setPosition(G3D::Point3(Vector3(camx, camy, camz)));' thing even though I put it at the end of App.onInit() it still stayed at the default position. And yes I am running the right project I tried loading another scene and it worked well.
Thanks for the response! 

Julien Matthey

unread,
May 16, 2022, 8:44:03 AM5/16/22
to G3D Users
By the way you don't need to use shared_ptr::get() and you don't need to construct a G3D::Point3 from a G3D::Vector3, you can just use an initializer-list: activeCamera()->setPosition({camx, camy, camz});

I assume you are new to C++ ?  ;-)

Tomáš Melichar

unread,
May 16, 2022, 10:18:25 AM5/16/22
to G3D Users
Yes, kind of. It was more like the first thing I thought of, because it was the thing visual studio said in the hint,  but the list doesnt fix it either. I have no idea whats causing this

Tomáš Melichar

unread,
May 16, 2022, 11:27:07 AM5/16/22
to G3D Users
Ok, wait a second, I just restarted my pc and it works now?? I have absolutely no idea what happened. Maybe some cache or something, I dont know. Anyways thanks for the help!
Reply all
Reply to author
Forward
0 new messages