[solved]flat ground made of many actors not so flat Author Message
dziablo
Member

07-29-2013 12:31 PM
kasinova
Member

 Post: #2 RE: flat ground made of many actors not so flat Hey! I'm sure it has something to do with the density of your ball.
08-01-2013 10:07 AM
dziablo
Member

 Post: #3 RE: flat ground made of many actors not so flat Thanks for answer but what do You mean? I changed density from 10(i dont know why it was 10 ) to 1 and its all the same.
08-01-2013 12:49 PM
kasinova
Member

 Post: #4 RE: flat ground made of many actors not so flat sorry! the ball actor mass. if it is a heavier mass (which takes more force to move) the less likely it will bounce when colliding with the corners of the ground box
08-02-2013 06:11 AM
SamNainocard
Member

 Post: #5 RE: flat ground made of many actors not so flat The reason of ball being 10 density because of ball .create(Ball(0.3 , Vec(2.5, 0, 2.5)), 10); About jumpy, it could be due to being different actor.
08-02-2013 06:24 AM
dziablo
Member

 Post: #6 RE: flat ground made of many actors not so flat Thank You all but what i need is perfectly flat ground.
08-05-2013 06:28 PM
kasinova
Member

 Post: #7 RE: flat ground made of many actors not so flat I built your version of the physics tutorial (I'm still on 1.0) and it works fine. the ball runs smoothly across all ground actors. The only difference in my code from yours is the Physics.create function "../installation/PhysX" Might not be much help but maybe there is a difference in our physics
08-06-2013 08:46 PM
aceio76
Silver Supporter

 Post: #8 RE: flat ground made of many actors not so flat To confirm, check what Physx engine is in use in code, ie Physics.engine().
08-06-2013 09:18 PM
dziablo
Member

 Post: #9 RE: flat ground made of many actors not so flat When i was looking for that engine stuff in Physics i found this: Code: `PhysicsClass& skin     (  Flt              skin   );   Flt                skin           ()C {return _skin        ;} // set/get physics skin width (allowed object interpenetration), default=0.005 (changing this value will not affect actors that are already created, in order to have one global skin value, please call this function after physics creation and before any actor creation)` i dont fully understand it but setting skin to 0 solves the problem Thank You everyone for help! Its very nice community i hope ill get good enough some day to help others. @kasinova Now i believe ball wasnt jumpy when You tested because example code was quite bad. Check that if You want: Code: ```/******************************************************************************/ Actor ground[100], box, ball ; /******************************************************************************/ void InitPre() { EE_INIT(); App.flag=APP_MS_EXCLUSIVE; } bool Init() { Cam.dist=4; // create physics Physics.create(EE_PHYSX_DLL_PATH); // create physics by specifying the path to physx dll's //Physics.skin(0); // create actors for(int i=0; i<100; i++) ground[i].create(Box (5, 1, 5, Vec(i*5, -2, 0)), 0); // create ground actor from Box and density=0 (which means it's a static actor - will not move) box .create(Box (0.3 , Vec(0.1, 1, 0))); ball .create(Ball(0.3 , Vec(2.5, 0, 2.5)), 10); return true; } /******************************************************************************/ void Shut() { } /******************************************************************************/ bool Update() { if(Kb.bp(KB_ESC))return false; CamHandle(0.1, 10, CAMH_ZOOM|CAMH_ROT); // physics update { Physics.startSimulation(); // start frame simulation // physics simulation takes some time, so you can do some calculations here // important : you may not modify actors between Physics.startSimulation() and Physics.stopSimulation() Physics.stopSimulation(); // get results of frame simulation } flt s=30; // add forces to ball if(Kb.b(KB_UP ))ball.addForce(Vec( 0, 0, 1)*s); if(Kb.b(KB_DOWN ))ball.addForce(Vec( 0, 0, -1)*s); if(Kb.b(KB_LEFT ))ball.addForce(Vec(-1, 0, 0)*s); if(Kb.b(KB_RIGHT))ball.addForce(Vec( 1, 0, 0)*s); // add forces to ball according to camera if(Kb.b(KB_W))ball.addForce( !PointOnPlane(Cam.matrix.z, Vec(0, 1, 0))*s); if(Kb.b(KB_S))ball.addForce(-!PointOnPlane(Cam.matrix.z, Vec(0, 1, 0))*s); if(Kb.b(KB_A))ball.addForce(-!PointOnPlane(Cam.matrix.x, Vec(0, 1, 0))*s); if(Kb.b(KB_D))ball.addForce( !PointOnPlane(Cam.matrix.x, Vec(0, 1, 0))*s); // add velocity to ball if(Kb.bp(KB_SPACE))ball.addVel(Vec(0, 3, 0)); Cam.at = ball.pos(); return true; } /******************************************************************************/ void Draw() { D .clear(); Physics.draw (); // draw physical actors D.text(0, 0.6, S+"Engine = "+ Physics.engine()    ); // Physics.engine() is 1; } /******************************************************************************/```
08-07-2013 01:01 PM
 « Next Oldest | Next Newest »