IrrNewt irrlicht\newton framework >> SVN access

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
RapchikProgrammer
Posts: 279
Joined: Fri Dec 24, 2004 6:37 pm

Post by RapchikProgrammer »

I searched a bit to know more about the irr to newt constants and i have mailed mercior about this too, havent got a reply yet tho! But what i have concluded from a convo between julio and mercior is that these constants apply only to all quake 3 levels! And that means if you create a bsp using gtk radiant u can use the constants! But this is just what i feel after looking at the convo between them! Will post again as soon as i get a response from mercior!
RapchikProgrammer
Posts: 279
Joined: Fri Dec 24, 2004 6:37 pm

Post by RapchikProgrammer »

I got the reply, here is what he says in the mail:
hello,

I havent coded with newton for some time now, but I suepect the constant is used as a scale multiplier between irrlicht units and newton units and vice versa.

Each system (newton and irrlicht) keep track of co-ordinates internally, so when newton calls back with "set this entitys position to x x x" , the co-ordinates provided in the matrix are in the unit scale of how newton sees the game world.If you've provided the game world data to newton in irrlicht units, then you wouldn't need to alter the values provided here as newton would be working in irrlicht units!

I cant entirely remember why I used this, but I would guess that it might be better to provide the world data to newton at a higher scale than irrlicht uses, so as to reduce the chance of floating point errors in newtons calculations.

So, once you've passed the world data to irrlicht at a higher scale (by multiplying it by irr_to_newton), you then must remember to scale it back down to irrlciht units when it comes to setting scene node positions.

Hope that helps,
Paul
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

But if both the graphical 1 unit and the newton 1 unit represents one meter, it will work, right?
newton works with ALL units. meters, kms, or if you pass a your unit (for example 1 your_unit = 1556.64 meters) Newton will work correctly. Pass meters is only a comfort for the user. if you pass distance as meters, mass as kg and acceleration as m\s*s (all standardized units) you will get the force ( IBody::getNetAppliedForce ) in newtons. If you don't pass mass as kgs exc.., but in a your unit system, you won't get force as newton, but in another unit system. Pass standardized unit system (meters) is a confort for the user, to retrieve data in a stadarzdized unit system (newtons)


Here are my opinion about the NewtonToIrr constant
but I suepect the constant is used as a scale multiplier between irrlicht units and newton units and vice versa.
But what i have concluded from a convo between julio and mercior is that these constants apply only to all quake 3 levels!
I think that Mercior, for example, has built in gtk a cube of 1x1x1 meters. In irrlicht the cube is not 1x1x1 but 32x32x32.
So, since Mercior know that newton works better with standardized units (see above), he decided to make the two constants to convert from irrlicht units into standardized units (meters). So since in gtk 1 meter is 32 irrlicht units, you need to apply this constant on all quake 3 maps built with gtk (as described by rapchik programmer).

I don't think this is due to numerical precision reason, since i have rounding float errors anyway, and have to call IUtils::round (wich is fabsf based), exapecially when i retrieve a force with NewtonBodyGetForce
[did you have this problem, RapchikProgrammer?]

However, the two constants of course are valid ONLY for the Mercior map (or at least for maps built with gtk) and NOT for all maps, so it would be definable by the user (because i can make a map in wich 1 meters is 50 units, for example)

But since if I set the constants to 1, the bodies are slower (react slower to forces) and ALL programs that use irrnewt need to be re-written (to improve forces), so i can't set both to 1 for default. And I also wonder why if I set the two constants to 1 the bodies are slower, don't have sense, but this is what happen

This is my opinion
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

white tiger wrote:However, the two constants of course are valid ONLY for the Mercior map
This is what I've been saying all along!

I'm altering my copy of the source so that either IrrToNewton is 1.0f or an internal variable I can set/get via a function call. I'll also alter the GRAVITY ifdef to an internal var so I can set it to what I need.
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

I have just released an example showing ragdolls, wich will be in the next release of irrnewt. You can find it in the first post, at the end
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

I cannot use this because it says you main include file "IrrNewt.hpp" is including "newton.h" which was not in the download??
TheQuestion = 2B || !2B
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Halifax wrote:I cannot use this because it says you main include file "IrrNewt.hpp" is including "newton.h" which was not in the download??
The text file source.txt in the "source" folder tells you that you need to download the Newton physics SDK.
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

DavidR
Posts: 34
Joined: Sat Jul 15, 2006 5:12 pm

Post by DavidR »

Hi there White Tiger,

I was just playing around with IrrNewt on my project, and I have a small query:

Is it possible to attach more than 1 collision hull/shape to a node? e.g. can I have an object with multiple box collision hulls on it?

And is it possible to set the offset of these hulls from the node?

I haven't seen any facility to attach >1 hull to a node, so I haven't tried it. But it'd be great if you could offer any kind of information about this. IrrNewt is great, and is progressing very well by the looks of it, so thank you very much for continuing to work on it :)

Thanks again.
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

do you mean compound collision?

if yes this isn't currently implemented in irrnewt, but i will implement it
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Am I right in thinking that the default vehicle (ICar) is RWD only? Do I have to write my own class is I want FWD or 4WD?

Also, I have simplified meshes for collision geometry in some instances. Can I use this hull instead of having a collision mesh generated from the render mesh?
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

ICar is a class wich make a 4 tires vehicle. if i haveunderstand your question, you can apply torque to backward tires only, forward tires only or to all tires.

There are some internal functions, only writing for user facility, wich assume the tires to apply torque are backward tires (the functions are ICar::forward() and ICar::backward() ), and I use them in my car example,
but you can apply torque to whatever tire you want manually. This code apply torque to forward tires only

car->getFRTire()->setTorque(your_torque)
car->getFLTire()->setTorque(your_torque)

and the same for all tires (simply get also the backward tires).

if you want to make a vehicle wich not contains 4 tires, you can't use ICar. in this case, then make a simple vehicle (IWorld::createVehicleSimple) and add manually all tires you need (IVehicleSimple::createTire)
Also, I have simplified meshes for collision geometry in some instances. Can I use this hull instead of having a collision mesh generated from the render mesh?
yes. when building the SBodyFromNode struct, set 'Mesh' attribute to the simplified mesh and the 'Node' attribute to the node generated from the high poly mesh. IrrNewt will get triangles for collision from the simplified mesh
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

white tiger wrote:ICar is a class wich make a 4 tires vehicle. if i haveunderstand your question, you can apply torque to backward tires only, forward tires only or to all tires.

There are some internal functions, only writing for user facility, wich assume the tires to apply torque are backward tires (the functions are ICar::forward() and ICar::backward() ), and I use them in my car example,
but you can apply torque to whatever tire you want manually. This code apply torque to forward tires only

car->getFRTire()->setTorque(your_torque)
car->getFLTire()->setTorque(your_torque)

and the same for all tires (simply get also the backward tires).

if you want to make a vehicle wich not contains 4 tires, you can't use ICar. in this case, then make a simple vehicle (IWorld::createVehicleSimple) and add manually all tires you need (IVehicleSimple::createTire)
Also, I have simplified meshes for collision geometry in some instances. Can I use this hull instead of having a collision mesh generated from the render mesh?
yes. when building the SBodyFromNode struct, set 'Mesh' attribute to the simplified mesh and the 'Node' attribute to the node generated from the high poly mesh. IrrNewt will get triangles for collision from the simplified mesh
Sounds good. I'll do some experimentation and see if I can set things up how I need.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

One material for the entire level? Have I got this right? I've looked at the Newton SDK tutorial samples and the same thing applies there - one "material" for the whole level. If, for example, my level has tarmac and grass then I have two different materials - I'd expect my vehicle to react differently to the two surfaces.

Is this a limitation of Newton or is there something I've missed?
Ico
Posts: 289
Joined: Tue Aug 22, 2006 11:35 pm

Post by Ico »

Just did a quick look as I'm interested in using a physics engine as well.

http://www.newtongamedynamics.com/forum ... php?t=3165

They talk about that "one material problem" and it seems like you can't use two materials within one object. So you can't assign another material to your chassis than that your wheels use and vice versa. But they talk about changing the cars material on the fly or attaching another node with a different material. So if the engine wouldn't support different materials, they wouldn't tell him to try that imo. :)

Edit:
http://www.saschawillems.de/?page_id=83
The bottom most demo has different ground materials. :)
Post Reply