About Store Forum Documentation Contact



Post Reply 
Noob question : EE 2.0 + Particles
Author Message
Marbasoft Offline
Member

Post: #1
Noob question : EE 2.0 + Particles
Hello all,

I've 2 problems...

- First problem :

In the editor i drop a campfire, at the same location i drop a fire particle and a smoke particle. all is ok in the editor.
[Image: particules.jpg]

I start my game, then my particles don't appears.
[Image: particules_in_game.jpg]



- Second problem :

In the editor you can see 2 campfire.
  • The one on the left is set as terrain object.
  • The one on the right is set as a custom object called OBJ_FIRE.


In my game, only the campfire on the left is drawn and i don't understand why :(

I declared :
Code:
Game.ObjMemx<Game.Item> FireCamps;
Game.ObjMemx<Game.Item> Trees;
Game.ObjMemx<Game.Item> Items;
Game.ObjMemx<Player> Players;

in my init function i write :
Code:
Game.World.activeRange(D.viewRange())
             .setObjType (Items, OBJ_ITEM)
             .setObjType (Players, OBJ_CHR)
             .setObjType (FireCamps, OBJ_FIRE)
             .setObjType (Trees, OBJ_TREE)            
             .New        (UID(357758064, 1257398427, 2580827025, 3499467452));
   if(Game.World.settings().environment)Game.World.settings().environment->set();

i notice that if i delete
Code:
.setObjType (Trees, OBJ_TREE)
trees are not drawn.

what's wrong ?

Thanks for help grin
03-15-2013 07:48 PM
Find all posts by this user Quote this message in a reply
gdalex Offline
Member

Post: #2
RE: Noob question : EE 2.0 + Particles
I have the same questions smile
03-16-2013 01:02 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Noob question : EE 2.0 + Particles
Hello!

You need to use Game.ObjParticles class for objects with "draw as particles"
03-16-2013 09:21 PM
Find all posts by this user Quote this message in a reply
gdalex Offline
Member

Post: #4
RE: Noob question : EE 2.0 + Particles
Is there a tuto/page about these game object classes ?
03-17-2013 08:29 AM
Find all posts by this user Quote this message in a reply
gwald Offline
Member

Post: #5
RE: Noob question : EE 2.0 + Particles
ObjParticle class is also part of ObjectCode which is part of your license
V1 tut 03-multiple worlds uses it, below.
Code:
/******************************************************************************/
#include "stdafx.h"
#include "main.h"
/******************************************************************************/
Game::ObjMemx<Teleport    > ObjParticles;
Game::ObjMemx<Game::Static> Statics;
Game::ObjMemx<Player      > Players;

UInt View=VIEW_TPP;
/******************************************************************************/
void InitPre()
{
   App.name("Multiple Worlds");
   App.flag=APP_FULL_TOGGLE|APP_MS_EXCLUSIVE;
   DataPath("../data");
   Paks.add("engine.pak");

   D.full(true).hpRt(true).viewRange(70);
   Cam.dist=3;
}
/******************************************************************************/
Bool Init()
{
   Physics.create("../Installation/PhysX");
   Sky    .atmospheric();
   Sun.image="Env/Sky/sun.gfx";

   Game::ObjType="Enum/obj_type.enum";
   Game::World.activeRange(D.viewRange())
              .setObjType (Players     , OBJ_PLAYER   )
              .setObjType (Statics     , OBJ_STATIC   )
              .setObjType (ObjParticles, OBJ_PARTICLES)
              .New        ("World/teleport 1.world");

   return true;
}
/******************************************************************************/
void Shut()
{
}
/******************************************************************************/
void UpdateCamera()
{
   // set next camera mode when Tab pressed
   if(Kb.bp(KB_TAB))
   {
      View=(View+1)%VIEW_NUM;
   }

   // setup the camera
   if(Players.elms()) // if we have at least one player
   {
      // set camera depending on current view mode
      switch(View)
      {
         case VIEW_FPP:
         {
            C OrientP &head=Players[0].cskel.getPoint("head"); // obtain player "head" skeleton point (this was created in Model Editor)
            Cam.setPosDir(head.pos, head.dir, head.perp); // set camera from 'head' position, direction and perpendicular to direction
         }break;

         default: // VIEW_TPP
         {
            Cam.dist=Max(1.0f, Cam.dist*ScaleFactor(Ms.wheel()*-0.1f)); // update camera distance according to mouse wheel
            Cam.setSpherical(Players[0].ctrl_pos+Vec(0,0.5,0), Players[0].angle.x, Players[0].angle.y, 0, Cam.dist); // set spherical camera looking at player position with given player angles
         }break;
      }

      // after setting camera position and angles:
      Cam.updateVelocities().set(); // update camera velocities and activate it
   }
   else // when no player on the scene
   {
      CamHandle(0.1f, 100, CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT)); // default camera handling actions
   }
}
/******************************************************************************/
void DetectTeleport() // detect if the player is inside a teleporter and change the world
{
   if(Players.elms() && ObjParticles.elms()) // if world has at least one player and particle object
      if(Dist(Players[0].pos(), ObjParticles[0].pos())<=1.5f) // if player stepped on a particle
         if(ObjParticles[0].target_world.is()) // if particle string has a valid text value
   {
      SG.changeWorld(ObjParticles[0].target_world);
   }
}
/******************************************************************************/
Bool Update()
{
   if(Kb.bp(KB_ESC))return false;

   DetectTeleport();
   Game::World.update(Cam.at);
   UpdateCamera();

   return true;
}
/******************************************************************************/
void Render()
{
   Game::World.draw();
}
void Draw()
{
   Renderer(Render);
   D.text(0, 0.9f, "Walk into the particles to teleport to a different world");
   D.text(0, 0.8f, S+"Current World: \""+Game::World.worldDir()+'"');
}
/******************************************************************************/

My Blog
http://www.esenthel.com/community/showthread.php?tid=6043

I hang out at Esenthel IRC Channel
http://webchat.freenode.net/?channels=#Esenthel
03-17-2013 09:16 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Noob question : EE 2.0 + Particles
(03-17-2013 08:29 AM)gdalex Wrote:  Is there a tuto/page about these game object classes ?
just set that class into Game.World.setObjType, that's it.

In EE Store for 2.0 license you can download source for game objects classes.
03-17-2013 01:24 PM
Find all posts by this user Quote this message in a reply
Marbasoft Offline
Member

Post: #7
RE: Noob question : EE 2.0 + Particles
Ok thanks a lot grin

and what about my second problem ?
03-18-2013 09:09 AM
Find all posts by this user Quote this message in a reply
gdalex Offline
Member

Post: #8
RE: Noob question : EE 2.0 + Particles
That's good for me too, thanks guys smile
03-18-2013 10:15 AM
Find all posts by this user Quote this message in a reply
Post Reply