Page 1 of 1

Rain does not show in cutscenes

PostPosted: 12 Jul 2017, 08:26
by anne10
Hello I'm a new member to this forum. I want to contribute and have already built the game which is running. The issue is that rain does not show in cutscenes and it was suggested to me by @samuncle. The link to the issue is
https://github.com/supertuxkart/stk-code/issues/2874

Since I'm new to this, it'll be very helpful to be given some direction as to how I should proceed. Awaiting your reply..
Thanking you

Re: Rain does not show in cutscenes

PostPosted: 12 Jul 2017, 20:59
by QwertyChouskie
Related (though fixed): https://github.com/supertuxkart/stk-code/issues/1704
Might have some useful info.

Re: Rain does not show in cutscenes

PostPosted: 12 Jul 2017, 21:41
by MTres19
Yes, most likely the particle emitter needs to follow the cutscene camera rather than the kart.

Re: Rain does not show in cutscenes

PostPosted: 14 Jul 2017, 23:26
by Auria
Another hint, take a look at Dm_sky_particles in file tracks/track.cpp and m_sky_particles_emitter in karts/controller/local_player_controller.cpp . It is indeed attached to a kart at this time

Re: Rain does not show in cutscenes

PostPosted: 15 Jul 2017, 11:35
by anne10
Hey Auria, thanks for your suggestion..
Here what i find is "m_sky_particles_emitter" is getting initialized over here:

{l Code}: {l Select All Code}
m_sky_particles_emitter =
            new ParticleEmitter(track->getSkyParticles(),
                                core::vector3df(0.0f, 30.0f, 100.0f),
                                m_kart->getNode(),
                                true);


so i think, i need to pass instance of cut scene or the cut scene camera in place of "m_kart".
Am I right ? if so then please let me know which exact instance i need to pass over here ?

(edit by charlie/mod - wrapped the code in appropriate tags)

Re: Rain does not show in cutscenes

PostPosted: 15 Jul 2017, 14:26
by MTres19
Sorry this isn't exactly an answer to your question, but I suggest looking at http://supertuxkart.sourceforge.net/doxygen/. You might find useful documentation there.

Re: Rain does not show in cutscenes

PostPosted: 15 Jul 2017, 23:07
by Auria
anne10 {l Wrote}:Hey Auria, thanks for your suggestion..
Here what i find is "m_sky_particles_emitter" is getting initialized over here:
m_sky_particles_emitter =
new ParticleEmitter(track->getSkyParticles(),
core::vector3df(0.0f, 30.0f, 100.0f),
m_kart->getNode(),
true);
so i think, i need to pass instance of cut scene or the cut scene camera in place of "m_kart".
Am I right ? if so then please let me know which exact instance i need to pass over here ?


I have not actually tried looking at the issue in detail, but from the top of my head what you are suggesting seems right

You can get the camera using Camera::getActiveCamera()->getCameraSceneNode() (graphics/camera.hpp)

Re: Rain does not show in cutscenes

PostPosted: 23 Jul 2017, 18:52
by anne10
Hey Auria
Could you please tell me how do I test the cutscenes if I've been successful in adding rain in that or not?
Kindly reply to the question..

Re: Rain does not show in cutscenes

PostPosted: 23 Jul 2017, 21:06
by QwertyChouskie
Add:

{l Code}: {l Select All Code}
<weather particles="rain.xml" lightning="true" sound="rain"/>


to the scene.xml of a cutscene, then run the cutscene. The easiest way is to add it to the GPwin cutscene, create a custom GP in the game that just has one lap of a short race e.g. mathclass, the win that "GP" to trigger the GPwin scene.

Re: Rain does not show in cutscenes

PostPosted: 23 Jul 2017, 23:43
by Auria
QwertyChouskie {l Wrote}:Add:

{l Code}: {l Select All Code}
<weather particles="rain.xml" lightning="true" sound="rain"/>


to the scene.xml of a cutscene, then run the cutscene. The easiest way is to add it to the GPwin cutscene, create a custom GP in the game that just has one lap of a short race e.g. mathclass, the win that "GP" to trigger the GPwin scene.


That's right, to elaborate a bit more, cutscenes are found under the "tracks" folder in the data folder, for instance tracks/gpwin. Another way to test without having to race every time is to edit file states_screens\main_menu_screen.cpp and change "#define DEBUG_MENU_ITEM 0" to "#define DEBUG_MENU_ITEM 1", this will enable debug options on the main menu screen that make it easier to trigger cutscenes from the main menu

Re: Rain does not show in cutscenes

PostPosted: 30 Jul 2017, 08:09
by anne10
i'm trying to add "m_sky_particles" (i.e ParticleSystem) in cutscene_world.cpp (as they are in local_player_controller.cpp), now to setup this particle system i need a camera instance to get current scene node, and a current particle kind which i have manually set to rain for now.

Here is constructor signature of "ParticleEmitter":

new ParticleEmitter (const ParticleKind* type, const Vec3 &position, scene::ISceneNode* parent = NULL, bool randomize_initial_y = false, bool important = false);

And here how i'm calling it (from CutsceneWorld::init() in cutscene_world.cpp):

Camera* stk_cam = Camera::createCamera(NULL);
m_sky_particles_emitter = new ParticleEmitter(ParticleKindManager::get()->getParticles("rain"),
core::vector3df(0.0f, 30.0f, 100.0f),
stk_cam->getCameraSceneNode(),
true);
So basically i think i need to setup this stk_cam first, based on camera of CutsceneWorld.
can anyone help to figure out how i can get the current camera over here ? and also let me know my approach is correct or not ?

Re: Rain does not show in cutscenes

PostPosted: 30 Jul 2017, 18:13
by QwertyChouskie
Maybe make the emitter a part of the camera rather than the world?

Re: Rain does not show in cutscenes

PostPosted: 30 Jul 2017, 23:33
by Auria
anne10 {l Wrote}:i'm trying to add "m_sky_particles" (i.e ParticleSystem) in cutscene_world.cpp (as they are in local_player_controller.cpp), now to setup this particle system i need a camera instance to get current scene node, and a current particle kind which i have manually set to rain for now.

Here is constructor signature of "ParticleEmitter":

new ParticleEmitter (const ParticleKind* type, const Vec3 &position, scene::ISceneNode* parent = NULL, bool randomize_initial_y = false, bool important = false);

And here how i'm calling it (from CutsceneWorld::init() in cutscene_world.cpp):

Camera* stk_cam = Camera::createCamera(NULL);
m_sky_particles_emitter = new ParticleEmitter(ParticleKindManager::get()->getParticles("rain"),
core::vector3df(0.0f, 30.0f, 100.0f),
stk_cam->getCameraSceneNode(),
true);
So basically i think i need to setup this stk_cam first, based on camera of CutsceneWorld.
can anyone help to figure out how i can get the current camera over here ? and also let me know my approach is correct or not ?


I have not actually tried it, but at a first glance your approach seems basically correct. Is there an issue? I don't think you mentionned what is the problem you're bumping into right now, if any

Re: Rain does not show in cutscenes

PostPosted: 31 Jul 2017, 06:27
by anne10
I'm getting many errors when I try this approach.. After these changes are made, I encounter an error in the function:
void CutsceneWorld::createRaceGUI()
{
m_race_gui = new CutsceneGUI();
} // createRaceGUI

Re: Rain does not show in cutscenes

PostPosted: 02 Aug 2017, 00:06
by Auria
okay, can you be more specific about what the error is? I can't really help you much from such a vague description, can you use a debugger to see why it crashes?