[SOLVED] Sphere sinking in a floor ;) - problem

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[SOLVED] Sphere sinking in a floor ;) - problem

Postby ryj3k » Wed Apr 01, 2009 1:06 pm

Hi again,
I'm trying to figure out how to scale bodies created in Newton to fit these created in IrrLicht.
I found useful tutorial where I found such code:
Code: Select all
dVector floorSize(100.0f,2.0f,100.0f,1.0f);
   dMatrix floorLocation(GetIdentityMatrix());
   floorLocation.m_posit.m_y = -5.0f;

   vector3df position (floorLocation.m_posit.m_x, floorLocation.m_posit.m_y, floorLocation.m_posit.m_z);
   position*=NEWTONTOIRR;
   float irrSize = floorSize.m_x*NEWTONTOIRR;
   floor = sceneManager->addCubeSceneNode(irrSize, 0, -1, position, vector3df(0,0,0), vector3df(1.0, 2.0/100.0, 1.0));

so
Code: Select all
dVector floorSize(100.0f,2.0f,100.0f,1.0f);
line stands for size of the floor object in Newton and
Code: Select all
floor = sceneManager->addCubeSceneNode(irrSize, 0, -1, position, vector3df(0,0,0), vector3df(1.0, 2.0/100.0, 1.0));
(exactly: vector3df(1.0, 2.0/100.0, 1.0)) stands for size of floor object in Irrlicht.

But such floor is a bit to small for me. I wanted to enlarge it by simply multiplying numbers by 10. So I get:
Code: Select all
dVector floorSize([b]1000.0f[/b],[b]20.0f[/b],[b]1000.0f[/b],1.0f);

and
Code: Select all
floor = sceneManager->addCubeSceneNode(irrSize, 0, -1, position, vector3df(0,0,0), vector3df([b]10.0[/b], [b]20.0/[/b]100.0, [b]10.0[/b]));


And here's my problem. I drop a sphere on this floor, but it sinks to the half of the sphere. When I try different multipliers the ball sinks anyway.
What is wrong, if I didn't provide enough data, I can post more, but I don't know where is problem here.
Last edited by ryj3k on Wed Apr 01, 2009 4:49 pm, edited 1 time in total.
ryj3k
 
Posts: 10
Joined: Tue Mar 31, 2009 5:54 pm

Re: Sphere sinking in a floor ;) - problem

Postby Auradrummer » Wed Apr 01, 2009 3:17 pm

ryj3k,

Could your sphere is small or the center of the collision shape isn't the center of the graphical object?
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Sphere sinking in a floor ;) - problem

Postby ryj3k » Wed Apr 01, 2009 4:10 pm

I found solution to my problem.

The parameter "vector3df(1.0, 2.0/100.0, 1.0)" in line
Code: Select all
floor = sceneManager->addCubeSceneNode(irrSize, 0, -1, position, vector3df(0,0,0), vector3df(1.0, 2.0/100.0, 1.0));

is Scale, not Size!

Then I had to match scale of my flor to real size of this floor.
So I normalized Scale Vector to match this:
Code: Select all
dVector floorSize(100.0f,2.0f,100.0f,1.0f);


Now everything is OK:), thanks for reply Auradrummer, but that wasn't the problem.
ryj3k
 
Posts: 10
Joined: Tue Mar 31, 2009 5:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 23 guests

cron