moving water
moving water
Hi,
Im new in irrlicht and i need to know how can i simulate a moving water (like a river).i was thinking to someting like moving the water texture but i don't know how
Sorry for my bad english
Please help me
Im new in irrlicht and i need to know how can i simulate a moving water (like a river).i was thinking to someting like moving the water texture but i don't know how
Sorry for my bad english
Please help me
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
First of all, learn patience. Why do you think that you receive answers in about 2 hours?
Next thing: What did you achieve as of now? As you see going through the tutorials would reveal much of Irrlicht's features. Maybe you find something useful in there.
Anyway, for a river some texture animator (either the one from Irrlicht or a custom one based on Texture matrices) might be what you need. Check that one and ask again if you tried it but did not succeed.
Next thing: What did you achieve as of now? As you see going through the tutorials would reveal much of Irrlicht's features. Maybe you find something useful in there.
Anyway, for a river some texture animator (either the one from Irrlicht or a custom one based on Texture matrices) might be what you need. Check that one and ask again if you tried it but did not succeed.
Hi, I don't understand textureMatrix() function
I have this little code :
#include <irrlicht.h>
#include <iostream>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
int main()
{
IrrlichtDevice *device =
createDevice(video::EDT_DIRECT3D8 , core::dimension2d<s32>(640, 480),
16, false,false);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
////water///
scene::ISceneNode* node = 0;
scene::IAnimatedMesh* mesh = smgr->addHillPlaneMesh("hill",
core::dimension2d<f32>(20,20),
core::dimension2d<s32>(40,40), 0, 0,
core::dimension2d<f32>(0,0),
core::dimension2d<f32>(10,10));
node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
node->setPosition(core::vector3df(0,7,0));
node->setMaterialTexture(0, driver->getTexture("../../media/water.jpg"));
///Light////
node = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f);
scene::ISceneNodeAnimator* anim = 0;
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
node->addAnimator(anim);
anim->drop();
///Camera///
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(core::vector3df(-50,50,-150));
device->getCursorControl()->setVisible(false);
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
can some one show me how to move texture "water.jpg" in that code(to simulate flow of a river)
Please help me because i need that. Thanks.
I have this little code :
#include <irrlicht.h>
#include <iostream>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
int main()
{
IrrlichtDevice *device =
createDevice(video::EDT_DIRECT3D8 , core::dimension2d<s32>(640, 480),
16, false,false);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
////water///
scene::ISceneNode* node = 0;
scene::IAnimatedMesh* mesh = smgr->addHillPlaneMesh("hill",
core::dimension2d<f32>(20,20),
core::dimension2d<s32>(40,40), 0, 0,
core::dimension2d<f32>(0,0),
core::dimension2d<f32>(10,10));
node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
node->setPosition(core::vector3df(0,7,0));
node->setMaterialTexture(0, driver->getTexture("../../media/water.jpg"));
///Light////
node = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f);
scene::ISceneNodeAnimator* anim = 0;
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
node->addAnimator(anim);
anim->drop();
///Camera///
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(core::vector3df(-50,50,-150));
device->getCursorControl()->setVisible(false);
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
can some one show me how to move texture "water.jpg" in that code(to simulate flow of a river)
Please help me because i need that. Thanks.
THANKS AGAIN FOR YOUR ANSWERS
I did this :
but nothing happend, the texture is't moving , what i made wrong?
EDIT: that code is updating every step(i put it in while loop)
I did this :
Code: Select all
river->getMaterial(0).getTextureMatrix(0).setTextureTranslate(x,y);
y=y+0.001f;
x=x+0.001f;
EDIT: that code is updating every step(i put it in while loop)
I think he wants to animate a mesh to make it look like its moving water.
The EASIEST way to do this would be creating a 3D model of it. I know you can use 3D World Studio to create a terrain, add water etc and load it on to Irrlicht. There's even a tutorial on it.
It's not easy animating water using a 3D engine- better to create a base model, load it and add the "water" model to the cordinates you want and scale it to fit.
It's the easiest way if you know how to model. Using transformers on seperate loaded models might get a bit messy, so transforming the model itself on 3DS Max or whatever might be what your looking for.
The EASIEST way to do this would be creating a 3D model of it. I know you can use 3D World Studio to create a terrain, add water etc and load it on to Irrlicht. There's even a tutorial on it.
It's not easy animating water using a 3D engine- better to create a base model, load it and add the "water" model to the cordinates you want and scale it to fit.
It's the easiest way if you know how to model. Using transformers on seperate loaded models might get a bit messy, so transforming the model itself on 3DS Max or whatever might be what your looking for.