About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
[BUG]freezePos not working
Author Message
Mardok Offline
Member

Post: #1
[BUG]freezePos not working
Good evening,

freezePosX, freezePosZ, freezePosY not working in "world mode". Its strange, because all is fine without world creation.

Sample to reproduce in attachment.

Code/Main
PHP Code:
Game.ObjMap<Player>Players;

void InitPre()

   
EE_INIT();

   
D.mode(1280,720);
   
D.sync(true);
   
   
D.viewRange(100); 
   
D.viewFrom(0.45);
   
D.shadowMode(SHADOW_NONE);
   
D.viewFov(DegToRad(45));    

   
Renderer.type(RT_SIMPLE).clear_color Color(70130255255);   
}

Bool Init()
{  
   
// physics     
   
Physics.create  (EE_PHYSX_DLL_PATHCSS_NONE);
   
Physics.gravity(Vec(0,-10.0,0));
   
Physics.timestep(PHYS_TIMESTEP_NUM);
   
Physics.precision(60);   
   
   
// world  
   
Game.World.setObjType(PlayersOBJ_PLAYER); 
   
Game.World.New(UID(332320567211300991431429786773618650229)); // create the world by giving path to world
      
   
return true;
}

void Shut()
{
   
Game.World.del(); 
}
/******************************************************************************/
Bool Update()
{
   
// inputs
   
if(Kb.bp(KB_ESC))return false;
   
   
// actor movement
   
if(Kb.b(KB_LEFT ))Players[0].actor.addVel(Vec0.20,   0));
   if(
Kb.b(KB_RIGHT))Players[0].actor.addVel(Vec(-0.20,   0)); 
   if(
Kb.b(KB_UP   ))Players[0].actor.addVel(Vec(   000.2));
   if(
Kb.b(KB_DOWN ))Players[0].actor.addVel(Vec(   00,-0.2));
   if(
Kb.b(KB_SPACE))Players[0].actor.addVel(Vec(   00.50));
   

   if(
Kb.bp(KB_X))Players[0].actor.freezePosX(true);
   if(
Kb.bp(KB_Z))Players[0].actor.freezePosZ(true);
   if(
Kb.bp(KB_Y))Players[0].actor.freezePosY(true);
   

   
   
Cam.transformByMouse(10100CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT));
   
Game.World.update(Cam.at); // update the world to given position
   
   
return true;
}

void Render()
{
   
Game.World.draw(); // draw world (this is done outside of 'switch(Renderer())' because world automatically detects active rendering mode)
}

void Draw()
{
   
Renderer(Render);
   
   
Physics.draw();
   
   
// basic debug info
   
TextStyle   ts;      
   
   
ts.align Vec2(1,-1);
   
ts.size  Vec2(0.050.05);

   
Flt    h   0.04f;
   
Flt    v   0.04f;
   
Flt    px  = -D.w()+ v;
   
Flt    py  D.h(); 
   
Vec2   pos(px,py);
      
   
py -=hpy -=hpy -=h;     

   
D.text(ts,px,py,S"CONTROLS:"); py -=h;  
   
D.text(ts,px,py,S"X or Z or Y = freeze actor axis X or Z or Y"); py -=h;   
   
D.text(ts,px,py,S"ARROW LEFT or ARROW RIGHT = move actor X or Z"); py -=hpy -=h
   
   
D.text(ts,px,py,S"ACTOR INFO:"); py -=h
   
D.text(ts,px,py,S"actor.freezePosX = " Players[0].actor.freezePosX()); py -=h
   
D.text(ts,px,py,S"actor.freezePosZ = " Players[0].actor.freezePosZ()); py -=h;
   
D.text(ts,px,py,S"actor.freezePosY = " Players[0].actor.freezePosY()); py -=h;
}
/******************************************************************************/ 

Code/Player Class
PHP Code:
/********************************************************************************​***********/
class Player Game.Obj
{
   
Actor    actor;                     


   
virtual void   pos    (C Vec    &pos   ){ actor.pos(pos       ); }  
   
virtual void   matrix (C Matrix &matrix){ actor.pos(matrix.pos); } 
   
   
virtual Vec    pos   (){ return actor.matrix().pos; } 
   
virtual Matrix matrix(){ return actor.matrix();     }  

    
   
virtual void   create     (Object &obj_params);
   
virtual Bool   update     (                  );  
   
virtual UInt   drawPrepare(                  );       

   
Player(){}
};

/********************************************************************************​***********/
void Player::create(Object &obj_params)
{
   
actor.create   (*obj_params.phys()       );
   
actor.matrix   obj_params.matrixFinal());
   
actor.mass     (5.0          );
   
actor.group    (AG_CONTROLLER);
   
actor.freezeRot(true         );   
}


Bool Player::update()
{
   return 
true;

 
UInt Player::drawPrepare()
{   
   return 
0;      



Attached File(s) Image(s)
       

.7z  freezePos.7z (Size: 13.45 KB / Downloads: 5)
(This post was last modified: 02-25-2019 02:41 PM by Mardok.)
02-25-2019 01:39 AM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #2
RE: [BUG]freezePos not working
When I try to compile the imported project, I get an Unresolved external symbol error (EE::CosSin(double &, double &, double)).
Do it import private/public files differently? (I am using engine build 58. Are you using the same?)
(This post was last modified: 02-25-2019 09:23 AM by Tottel.)
02-25-2019 09:22 AM
Find all posts by this user Quote this message in a reply
Mardok Offline
Member

Post: #3
RE: [BUG]freezePos not working
Engine Build: 58

I don't use any any externals, just pure Esenthel files.
I downloaded and tested attachment and work/compile without any problems i dunno why errors :/
I added all source code Main and Player class and as you can see its simple Esenthel project with few elements created in EEngine.
(This post was last modified: 02-25-2019 11:38 PM by Mardok.)
02-25-2019 11:17 AM
Find all posts by this user Quote this message in a reply
Mardok Offline
Member

Post: #4
RE: [BUG]freezePos not working
Guys, is someone there?
I think problem occurs when we use our custom class based on Game.Obj class.
I had half year break and when downloaded last engine version this thing stop work. On older version all is fine.
02-28-2019 10:47 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: [BUG]freezePos not working
Hi sorry for late reply, I'll check this soon. Now sick in bed :( recovering from a cold
03-06-2019 06:34 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: [BUG]freezePos not working
Looks like some issue in PhysX.
One workaround is to call Physics.stopSimulation(); after Game.World.update();
03-09-2019 08:55 AM
Find all posts by this user Quote this message in a reply
Mardok Offline
Member

Post: #7
RE: [BUG]freezePos not working
Ty for info. I change topic to SOLVED when they fix physx and all back to normal.
(This post was last modified: 05-14-2019 09:33 PM by Mardok.)
03-09-2019 10:47 AM
Find all posts by this user Quote this message in a reply
Post Reply