About Store Forum Documentation Contact



Post Reply 
Dynamically create terrain OBJs
Author Message
mixpro Offline
Member

Post: #1
Dynamically create terrain OBJs
Hi ,
i have an objects if i assign to them class OBJ_ITEM they get drawn , but if i change it to terrain they don't , the items are created dynamically using Game.World.objCreate(); .
in Init() function i have :
Code:
Game.World.activeRange(D.viewRange())
             .setObjType(Items, OBJ_ITEM)
             .setObjType (Chrs, OBJ_CHR)
             .New        (UID(3199326727, 1331546700, 2335466931, 1420158981))
             .update     (Cam.at);
   if(Game.World.settings().environment)Game.World.settings().environment->set();

as documentation says , they should be without parameters ,and can't be accessed from code .
the problem is i want them to be terrain because i want them for path finding like in pathfinding tutorial , i am creating them dynamically and i can't create them statically in a world - i mean its for game levels i dont want to create hundreds of worlds (for each level) , thats why a wrote class to draw them dynamically but for now only works with OBJ_ITEMs .
what can i do to get pathfinding functionality works with my objects ?
(This post was last modified: 04-28-2016 03:36 PM by mixpro.)
04-28-2016 03:36 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #2
RE: Dynamically create terrain OBJs
you can use game::static with PathObstacle, or you can derive Game::obj and make your own object that uses PathObstacle.
04-28-2016 05:44 PM
Find all posts by this user Quote this message in a reply
mixpro Offline
Member

Post: #3
RE: Dynamically create terrain OBJs
(04-28-2016 05:44 PM)Zervox Wrote:  you can use game::static with PathObstacle, or you can derive Game::obj and make your own object that uses PathObstacle.

Thanks , it worked , but there was no need for game::static , i just did :
Code:
Shape sh_obs_1;
PathObstacle p_obs_1;
ObjectPtr obs_1 = ObjectPtr(UID(2974921294, 1562076937, 2171427043, 2778642899));
sh_obs_1 = Shape(obs_1->mesh()->box);
sh_obs_1.move(Vec(2.0,0.4,0.0));
p_obs_1.create(sh_obs_1,&Game.World.path());

and object is OBJ_ITEM class
04-29-2016 07:52 PM
Find all posts by this user Quote this message in a reply
Post Reply