Newton mercior tutorial code: boxes frozen again

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

levante wrote:YOU ARE MY SWEET, WONDERFUL PERSONAL GOD SiO2!!!!! I adore you!!!!!!!!!! I have been working and thinking on this for weeks and yes I already knew that it was a problem of world size... If u remember I already wrote it in previous post but I didn't know how to change world size!!! I would have never thought of removing that line... It looks impossible to me that it works without defining world size!!
Anyway great JOB, excellent, applause!!!!
:D :D :D :D :D :D :D
:mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen:

Next task is to work out a proper bounding box for the world, but I guess you can have a go at that yourself now it's working.

I assume that Newton's default world size is either "very big" or infinite.

Email me a beer. :wink:
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Enabling vsync when creating the device made the demo smooth as silk on my machine. Newton is updated at 100Hz in the demo, so this is now closer to my refresh rate, I guess.

Perhaps I would think about working out the frame delta and not updating Newton unless a certain time has elapsed (say, 1/30th of a second).

I spent ages throwing crates into the bsp world and seeing them interact. :lol:
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Reading the docs, Newton has a default world size of 100 units. Anything that moves out of range gets frozen. I now see why everything in the demo is scaled by 1/32 before sending to Newton - it's to try and fit in the default world size. :wink:

Some of the bsps that come with Quake3 don't fit well in this default world size though. Strange thing is, I can't get Newton to play happy with any world size I give it (via NewtonSetWorldSize()). Calculating the bbox from world geometry doesn't seem to work and even passing a huge world size (+/- 1000000) doesn't seem to work either. Weird...
levante
Posts: 13
Joined: Wed Oct 11, 2006 1:03 pm
Contact:

Post by levante »

Yeah you're right I also tried to play with the setWorldSize as I already said but got no working result :-( and you are terribly right even on framerate. Do you think that if we find the proper way of setting the world size our framerate will get better? I think so but meanwhile I think your idea of updating newton only after certain time is very good. :-) Thanks thanks thanks

P.S. Your address for the email-beer?? :-P
Marco Del Percio
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

I've just noticed that Newton have a newer version out than I was using. Once I got that (1.53) things seem to be working OK. :)
anyonei
Posts: 1
Joined: Sat Jun 09, 2007 11:41 pm

Post by anyonei »

im using exact same copy of levante's code and
when clicked lmouse button where its supposed to create a new box it gives

access violation

tmpc->mesh = smgr->getMesh("smallcube.3ds");
tmpc->node = smgr->addAnimatedMeshSceneNode(tmpc->mesh);
tmpc->node->setMaterialTexture(0, driver->getTexture("crate.jpg"));
tmpc->node->setMaterialFlag(video::EMF_LIGHTING, false);
// Create a box primitive. 38 is just an estimated value of the size of the model,
float x = 40 * IrrToNewton;
float y = 40 * IrrToNewton;
float z = 40 * IrrToNewton;
NewtonCollision* collision;
>>>>>>> collision = NewtonCreateBox(nWorld, x, y, z, NULL);
NewtonBody* body;

and i tried many times many different ways no matter what i did it gives same error any ideas thx.
Post Reply