Marbasoft
Member
|
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.
I start my game, then my particles don't appears.
- 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
|
|
03-15-2013 07:48 PM |
|
Esenthel
Administrator
|
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 |
|
gdalex
Member
|
RE: Noob question : EE 2.0 + Particles
Is there a tuto/page about these game object classes ?
|
|
03-17-2013 08:29 AM |
|
gwald
Member
|
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 |
|
Esenthel
Administrator
|
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 |
|
Marbasoft
Member
|
RE: Noob question : EE 2.0 + Particles
Ok thanks a lot
and what about my second problem ?
|
|
03-18-2013 09:09 AM |
|