About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
How to began with cars?
Author Message
Truelegend Offline
Member

Post: #16
RE: How to began with cars?
i writed mini class but when i set camera position at Cars[0] is not near car is somewhere under world :(.


If someone can explain how this everything works. How to do classes in Esenthel.
(This post was last modified: 04-17-2011 12:32 PM by Truelegend.)
04-17-2011 12:29 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #17
RE: How to began with cars?
you need to update the position of the camera in your update loop.

There is always evil somewhere, you just have to look for it properly.
04-17-2011 12:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Truelegend Offline
Member

Post: #18
RE: How to began with cars?
Its code
Code:
#include "stdafx.h"
#include <EsenthelEngine/Enum/_enums.h>

STRUCT(Car, Game::Item)
//{
    Flt angle;
    Actor tcar;
    Mesh tcarm;
    Wheel wheels[4];
    Wheel::Param WP;

    virtual Bool init();
    virtual Bool update();
};

Game::ObjMemx<Game::Static> Statics;
Game::ObjMemx<Game::Item  > Items  ;
Game::ObjMemx<Game::Chr> Chrs   ;
Game::ObjMemx<      Car> Cars   ;

Bool Car::init()
{
    tcar.create(Box(2,1,4)).draw(RED);
    tcar.massCenterL(tcar.massCenterL()-Vec(0,0.8f,0));
    return true;
}

Bool Car::update()
{
    return true;
}

void InitPre()
{
   App.name("EE - Test");
   App.flag=APP_MS_EXCLUSIVE|APP_FULL_TOGGLE|EE::APP_MAXIMIZABLE;
   DataPath("../data");
   Paks.add("engine.pak");
   D.full(false).sync(true).ambPower(1);

}

Bool Init()
{
   Physics.create(CSS_NONE,true,"../Installation/PhysX");

   Game::World.init()
              .setObjType(Statics,OBJ_STATIC)
              .setObjType(Items  ,OBJ_ITEM  )
              .setObjType(Chrs   ,OBJ_CHR   )
              .setObjType(Cars   ,OBJ_CAR   )
              .New("world/sample.world");



   return true;
}

void Shut()
{
}

void UpdateCamera()
{

            Cam.yaw  -=Ms.d().x;
            Cam.pitch+=Ms.d().y;
            Cam.dist=0.5f;    
            Cam.setSpherical(Cars[0].pos(), Cam.yaw, Cam.pitch, 0, Cam.dist); // set spherical camera looking at player using camera angles
            Cam.updateVelocities().set();     
}

Bool Update()
{
   if(Kb.bp(KB_ESC))return false;
   Game::World.update(Cam.at);
   UpdateCamera () ;
   return true;
}

void Render()
{
    Game::World.draw();
}

void Draw()
{
    Renderer(Render);
    SetMatrix(MatrixIdentity);
}

Screen from World Editor:
[Image: 58874403.png]

Screen from Game:
[Image: gametk.png]

So can aynone explain. say what i doing wrong ? thanks
04-17-2011 12:42 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #19
RE: How to began with cars?
you need to create your car object.

PHP Code:
virtual void create(Game::ObjParams &obj);

void Car::create(Game::ObjParams &obj)
{
   
__super::create(obj);


this in your update loop
PHP Code:
Cam.setSpherical(cars[0].pos()+Vec(0,1,0),cars[0].angle.x,cars[0].angle.y,0,Cam.dist*ScaleFactor(Ms.wheel()*-0.2f));
Cam.updateVelocities();
      
Cam.set(); 

But please look at the tutorials..... you can find everything there.

There is always evil somewhere, you just have to look for it properly.
04-17-2011 12:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Truelegend Offline
Member

Post: #20
RE: How to began with cars?
okey but what i must do with?
virtual void create(Game::ObjParams &obj);
i added this to class but next?
////
and this what you gived before doesnt work ....
////
and dont think i am stupid. but when i programming with Ogre3d its other then EE.

i just writed a class Car. later i set camera behind car. etc... Here in ee is another. And i am beginner in writing games. Sorry for all problems.
But when i want something go work. it never work :(
(This post was last modified: 04-17-2011 12:57 PM by Truelegend.)
04-17-2011 12:52 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #21
RE: How to began with cars?
Dude do some research... we are not here to create your game.. just to help at some parts.

Maybe follow your own advice would be a wise choice.

(04-15-2011 06:49 PM)Truelegend Wrote:  If you don't know c++. Dont start programming 3d games ...
First write little programs (console,later gui), later 2d and last 3d.

For help: Google (C++ Tutorials);

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 04-17-2011 01:01 PM by Dynad.)
04-17-2011 12:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Truelegend Offline
Member

Post: #22
RE: How to began with cars?
Yeah. I think write own engine is easier then write in EE. I maked My own 3d engine before and little 3d pseudo-games. But i dont understand somethings in ee.

Why
STRUCT(...,..)
//{ why here is comment?
} // and here is normal ??

it lot of stupid thing here ;. which i dont understand
And why i must use Game::Item to make my class why i cant just use class ?
(This post was last modified: 04-17-2011 01:00 PM by Truelegend.)
04-17-2011 12:59 PM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #23
RE: How to began with cars?
Thats why you need study tutorials. For class/struct you can use c++ style. I write it above.
Quote:class Car : Game::Item
{
};
04-17-2011 01:05 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #24
RE: How to began with cars?
STRUCT(...,..)
//{ why here is comment?
} // and here is normal ??

this is the same as:

struct Cars : Game::Item
{
};

the difference is that the STRUCT declaration also works on other devices besides Windows.

You don't need to use Game::Item.. but then u need to write all init/draw/render/etc.. functions yourself.

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 04-17-2011 01:07 PM by Dynad.)
04-17-2011 01:06 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Truelegend Offline
Member

Post: #25
RE: How to began with cars?
okey now i understand. but is one thing/problem. When i have OBJ_CAR i cant see it in my game. :(
04-17-2011 01:08 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #26
RE: How to began with cars?
Just study the tutorial: 03 - World with Character.cpp.

After you have done that, you can answer that question yourself.

There is always evil somewhere, you just have to look for it properly.
04-17-2011 01:11 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Truelegend Offline
Member

Post: #27
RE: How to began with cars?
I have done world with character. animations. But when i make a OBJ_CAR i cant see it!
I can see it just in world editor. but in Play mode i cant see.
i cant do a car :( because i dont know how to. In other engines i know but i dont know in ee.
(This post was last modified: 04-17-2011 01:34 PM by Truelegend.)
04-17-2011 01:32 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #28
RE: How to began with cars?
Thats because the WE only supports the default enums. If you want your own enums you need to purchase the company license.

There is always evil somewhere, you just have to look for it properly.
04-17-2011 01:35 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Truelegend Offline
Member

Post: #29
RE: How to began with cars?
so i cant make my car class?

Can anyone check this class?
Code:
/*****************************************/
class Car : Game::Item {
public:
    Flt           WheelAngle  ;
    Actor         CarActor    ;
    Mesh          CarMesh     ;
    Wheel         CarWheel[4] ;
    Wheel::Param  WP          ;
    
    virtual Bool init  () //some things i know what goest there
    {
        CarActor.create (Box(2,2,4));
        Car     .massCenterL(Car.massCenterL()-Vec(0,0.8f,0));

        CarWheel[0].create(CarActor,Matrix().setPos(Vec(1,-0.5f,1.5f)), WP);
        CarWheel[1].create(CarActor,Matrix().setPos(Vec(-1,0.5f,1.5f)), WP);
        CarWheel[2].create(CarActor,Matrix().setPos(Vec(1,-0.5f,-1.5f)), WP);
        CarWheel[3].create(CarActor,Matrix().setPos(Vec(-1,-0.5f,-1.5f)), WP);

        return true;

    }
    virtual Bool update();//dont know what goest here...
    {
        AdjustValTime(WheelAngle,(Kb.b(KB_D)-Kb.b(KB_A))*PI_4,0.0.1f);
        Flt accel=(Kb.b(KB_W)-Kb.b(KB_S))*1600,
            brake=Kb.b(KB_SPACE)         *3600;

        CarWheel[0].angle(WheelAngle).accel(accel).brake(brake);
        CarWheel[1].angle(WheelAngle).accel(accel).brake(brake);
        
    }
    virtual Bool camera();//camera behind car.. ?
    {
        return true;    
    }
}
/*****************************************/

It its good?
04-17-2011 01:50 PM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #30
RE: How to began with cars?
Tutorials 8 and 9 from Game Basic.
Try write like in 8 file. If you post screen with loaded your car i will help with rest.

From my game:
[Image: carrace01.th.jpg]

Uploaded with ImageShack.us

But I don't know why you want to make car from space ship?
(This post was last modified: 04-17-2011 02:04 PM by Seba.)
04-17-2011 02:01 PM
Find all posts by this user Quote this message in a reply
Post Reply