Newton Dynamic Physics Integration

Programming Reality Factory and Genesis3D.
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

the first release features only entities for the editor, the scripting part will come in a second release. I'm working on a set of simply demos to show you how to use the entities.
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

another step: you can attach other entities to the Rigid Bodies (DSpotLights, spouts...). :twisted:
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

closer and better: breakable joints implemented
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Post by fps »

:shock: man. you are incredibly fast.
you must really put a lot of effort into this.
it looks like its going to come out great.
it really does.
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.

2 wrote:
You say that like it's a bad thing.

1 wrote:
You are a bad thing.
User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Post by bernie »

:D Federico you are my hero... Great stuff man.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

bernie wrote:Federico you are my hero... Great stuff man.
Couldn't put it any better myself! Absolutely fantastic. :D
Pain is only psychological.
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

Most of those features were here but buggy: now I'm bugfixing them all. This moring I solved the staticMesh collision: Now the the physics world can be extended to the staticmeshes. The last task is to optimize the ragdoll entity. I will release with the two standard skeletons (farcry and valve) then, according to the request I could release a new version with some .ini definitions for the ragdoll parameters, but right now I didn't understand the why-and-how of the parameters I used... So right now you have to stay with my skeletons and enjoy all the other goodies.
I want to release: all this stuff is becoming really hot in my hands... :wink:

I'm putting up a site for the release...
User avatar
fps
Posts: 504
Joined: Mon Sep 26, 2005 9:54 pm
Location: in a magical land devoid of hope, happiness, and sanity.

Post by fps »

i cant wait!!!!!!!!!!!!!!!! this is really awsome.
one thing i would like to try to do in the fuure with this is have physics enabled pickup weapons. i think its awsome (altough slightly heartbreaking) to se your oponents weapon fly through the air and clatter loudly to the ground at you feet as you just empty yours into him.
even in system shock 2, when you droped your weapon it clanked loudly. which was both creepy and realistic.
physics really rocks!!!
1 wrote:
for the internet is a cruel and dark place at times, and there's sex and blood everywhere.

2 wrote:
You say that like it's a bad thing.

1 wrote:
You are a bad thing.
kikosmalltalk
Posts: 37
Joined: Mon Sep 25, 2006 1:12 pm

Post by kikosmalltalk »

Hi federico

Thank you for their attention and forgive my delay to respond.

you wrote:

If you are talking about scale, I don't have any scale, so 1 texel is 1 newton unit.


Yes, on that it is my question !!!.
Now. In their demo, a box has a dimencion of: 5 meters, 30 meters, or ?? . And an mass of ?

Me also use 1 meter = 1 texel.
As I understand, the dimensions and measures are important for Newton correct operation.
It is not the same thing a simulation of a body that measures 100 meters and a mass of 10000 Kg that a body that has 3 meters and a mass of 1000 Kg.

It is for this reason that I reduce my maps to a size of:
500 long
100 high
500 width.

And my car to:
3 long
1.5 high
1.7 width


Code: Select all

//Tick 
float dwTicks = 0.0f; 
dwTicks = (float)(TimeTicks)/IterationTime; 

for (int p = 0; p <(1 + dwTicks); p++) 
{ 
for(int s=0; s<UpdateLoop;s++) 
{ 
NewtonUpdate (nWorld, dwTicks*AdvanceTime); 
} 
}


With the form of solving Newton update.
Don't you have stutterer problems?.

See this article:

http://www.gaffer.org/game-physics/fix-your-timestep/

Best regards, KIKO
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

Me also use 1 meter = 1 texel.
As I understand, the dimensions and measures are important for Newton correct operation.
It is not the same thing a simulation of a body that measures 100 meters and a mass of 10000 Kg that a body that has 3 meters and a mass of 1000 Kg.
That's not the point, kiko. The physics engine is unit agnostic so that a body of 100meters with a mass of 10000Kg should behave exactly in the same way of a body of 1 meters and 10Kg. Equal ration between dimensions and mass should return the same result. In your example

100meters : 10000Kg != 3meters : 1000Kg

while instead

100meters : 10000Kg = 1meter : 10Kg = 3meters : 30Kg

Anyway, this is true with some limitations, but they doesn't apply for us: In fact all the topic about scale in the Newton forum are about "scaling up" the world to have millimeters and grams in order to avoid the freeze treeshold. We have instead a world to "scale down" instead...
With the form of solving Newton update.
Don't you have stutterer problems?.
That code come from Nout. The point is that RF have an internal timeslicer: in fact the Tick(); executes the loop that lasts exactly the time sliced by the CCommonData class. I don't know if this applies also in your project. I have some sturrering due to the media playing (sound and spout effects) during the collisions. Right now my simulation seems to be in time, but I know that a better updating procedure could be achieved.

I think I should study better these notes from walaber docs:

http://walaber.com/newton_wiki/index.ph ... cing%22%3F
http://walaber.com/newton_wiki/index.ph ... nUpdate%3F

and eventually this:
http://walaber.com/newton_wiki/index.ph ... n_extremes

Eventually I think that my sinulation could be affected by this:

In certain circonstance, the use of time-slicing can lead to a paradoxe in which the time required to update physics will become greater than the time-slice itself.

When the application enters this paradoxe, it starts to works more and more slowly. Each use of the « while » loop (as described in this example) will require more and more time to be completed, and the application will quickly seems to be frozen.

To avoid to enter this paradoxe, one solution is to filter the delta-time (the « milliseconds » variable in the example) so it will never get greater than a limit of your choice.
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

last feature added: the Attribute entity can be spawned now as Physics entity. Supports reSpawn and triggering.

My tasks are now complete. I'm packing the first release. Sourceforge has graciously given me an host and svn.

Prepare yourself :wink:
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

Ready to release, I see that the breakable joint doesn't work anymore, and I don't know why... :evil:
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

Sweet! Does the version have the sin and cos functions in scripting? I really need them to align my scripted weapons properly with the camera.
Pain is only psychological.
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

yes, they're in 075C so they're in my release.
i added these commands:
AddHashCommand("SetRelBoneRotation", 188); // SetRelBoneRotation
AddHashCommand("SetWeaponActorName", 189); // SetWeaponActorName
AddHashCommand("ChangeEntityName", 190); // ChangeEntityName
AddHashCommand("GetCameraHeight", 193); // GetCameraHeight
AddHashCommand("SetCameraHeight", 194); // SetCameraHeight
AddHashCommand("SetCameraOffset", 195); // SetCameraOffset
AddHashCommand("EnableStencilShadows", 196); // EnableStencilShadows
AddHashCommand("SetRelBonePosition", 197); // SetRelBonePosition
AddHashCommand("SetBoneGlobalRotation", 198); //
AddHashCommand("GetActorBoneRotation", 199); // GetActorBoneRotation
they're quite self-explanatory. I simply have to give up my first plan to write all the documentation before the release. I have to release and then write the docs. I don't want to let you wait anymore and I need to let someone else look at my work just to relax myself a bit.
I think that tomorrow could be the right day for the release.

:wink:
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

breakable joints working again... :lol:
Attachments
screen007.JPG
granade shooting a door...
(230.91 KiB) Downloaded 18 times
Post Reply