Random paths

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
st0ph
Posts: 27
Joined: Sat Aug 04, 2012 3:00 pm

Random paths

Post by st0ph »

Hello there ^^

I was wondering how can I associate random paths to my secondary caracters as like in coppercube, but this time with code ?

.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Random paths

Post by CuteAlien »

I don't know what coppercube does.... is this about having objects follow a fixed path somehow? Take a look at ISceneManager::createFollowSplineAnimator. That might be what you are looking for (or something similar).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: Random paths

Post by Cube_ »

If I understood his post correctly...
He wants something similar to a fixed path for the object to follow, but he wants it randomly generated during runtime.
"this is not the bottleneck you are looking for"
st0ph
Posts: 27
Joined: Sat Aug 04, 2012 3:00 pm

Re: Random paths

Post by st0ph »

I wanted to use

Code: Select all

createFollowSplineAnimator
but it does not rotate the node when the mesh is supposed to turn :/
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Random paths

Post by CuteAlien »

Hm, yeah - I think we have no animator for that so far. So you'll have to write your own (you can maybe start by copying the code of that one - and then just adapt the rotation). Or write a patch that allows rotation to happen as well (controlled by a flag), then we can apply that to the engine.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Random paths

Post by smso »

You may take a look at the class NpcPathControl in the snippets:

http://irrlicht.sourceforge.net/forum/v ... =9&t=46437

Simple use (see also main.cpp):

Code: Select all

NpcPathControl* npcPathControl = new NpcPathControl(device, fairy);
npcPathControl->setSpeed(200.0f);
npcPathControl->setWaypoints(points);
npcPathControl->start();
 
and in the main loop:

Code: Select all

npcPathControl->update();

Regards,
smso
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Random paths

Post by hybrid »

I think I also have some patch for such an animator somewhere. So there should be at least some code on the forums for exactly such an animator.
Post Reply