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 » Fri Oct 12, 2007 2:12 pm

ok, let's make some clarification.

@fps
1) Ragdoll skeletons. I think I should make an .ini reader to get the skeleton parameters. Though right know I didn't understand why I have to ad those value as base rotation of the bone. In fact I've empirically found the values and they don't seem related at all to the joint base rotation you could read in the modeler. Even stranger: the rotation needed to place the physical objects that compose the ragdoll differs from the rotation needed to align the bones to the objects once the ragdool is activated. So, if you really want to have an ini definition for this you should wait more time, first I have to understand the issue. Right now you can have the farcry model (setup and alignment correct) and hl2 model (incorrect setup and correct alignment).

2) about the mounth animation, I don't know what to say. I suggest you to work with the smd format (in 3dsmax and milshape) because you can manage the animation in a easier way. I use the bdy and mot format as final step. Don't you know that in smd format you can export only the legs or torso animation (preserving the Bip01 root), deleting the bones you don't need, to import them in a complete animated skeleton to override ony the imported bones? I think that the bone commands can't help you.

3)
You wrote:
Today I solved the pivot issue
Could you explain as it got it?
the offset matrix must be initialized completely, including the balck spot matrix[0][4], matrix[1][4], matrix[2][4], matrix[3][4], (or matrix[3],matrix[7], matrix[11], matrix[15]). That was my problem. So to have a compete initialization I let newton do the work for me, makung him computing a matrix from an euler triplet (NewtonSetEulerAngle). Then I add the offset translation (matrix[12],matrix[13],matrix[14]), calculating the translation as a fraction of the BBox. So OffsetY=0.5 will raise the collision box to the center of a standard Genesis actor (Y>0).

Code: Select all

geExtBox theBBox;
		CCD->ActorManager()->GetBoundingBox(PhActor[Ph_rgNr], &theBBox);

		float DeltaX = (theBBox.Max.X - theBBox.Min.X)*ActorScale.X;
		float DeltaY = (theBBox.Max.Y - theBBox.Min.Y)*ActorScale.Y;
		float DeltaZ = (theBBox.Max.Z - theBBox.Min.Z)*ActorScale.Z;

		float offset_matrix[16];

                geVec3d Rot_Zero;
                geVec3d_Set(&Rot_Zero, 0.0f, 0.0f, 0.0f);

		NewtonSetEulerAngle(&Rot_Zero.X, &offset_matrix[0]);

		offset_matrix[12] = (float)DeltaX*Offset.X;
		offset_matrix[13] = (float)DeltaY*Offset.Y;
		offset_matrix[14] = (float)DeltaZ*Offset.Z;

		// create the collision
		collision = NewtonCreateBox (nWorld, DeltaX, DeltaY, , &offset_matrix[0]); 
many thanks to julio jerez...

4) breakable joints are possible, I've tried but I get crashes and instability: not this release for sure, sorry.

5)
we just use like a script command to make the thing go ragdoll mode?
one more question.
will we be able to match the ragdoll to the pawns bone position like last time, so it flows smoothly?
Yes, to enable the ragdoll you have to SetEventState("EntityName_Die", true);
and yes, as I said earlier the farcry skeleton correctly setup itself to match the actor bone rot and pos.

6) I didn't understand the question about dimension, kiko, sorry. If you are talking about scale, I don't have any scale, so 1 texel is 1 newton unit. The physics engine is supposed to be agnostic about the unit type. The genesis scale anyway is really large, and the newton update is capped to a defined framerate, so I changed the NewtonUpdate I posted before.
Same parameters as above:

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);	
		}	
	}
UpdateLoop is defined in the physicsSystem entity and force the phsycisengine to run multiple update in the same frame, so you can set an higher value of iterationtime (that makes the simulation more precise and realistic) while making the physics engine steps two or three time faster than the graphics.

6) some update by me:

- Barrel physics using cylinder primitive.
- The physicsJoint entity is ready. Three joints: hinge, ballandsocket, slider. I'm testing.
- The PhysicsEntityCapsule is ready. This entity place a primitive around a genesis entity (a pawn for example) to simulate the collision for newton bodies. So when the pawn hits a newton body makes the object react and vice-versa. It's a way to integrate the two worlds, genesis and newton, without replacing all the collison system. This means that the two engines could run faster and that the equilibrium is quite fragile.

Theorically I completed my tasks, besides the needed bugfixing and testing.
I need an artist who creates an arena level for me, detailed and graphically optimized. Testers are also welcome but I'm willing to accept only people with Rf experience and with an existing and working project: we have to focus on physics and optimization, creating documentation and tutorials. If no one wants to help, I will release anyway but the doc and tut part will come later in the forum.

I always trust that QoD could have some interest in this release... :D

Bye.

Federico :wink:
Last edited by federico on Fri Oct 12, 2007 4:55 pm, edited 1 time in total.

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 » Fri Oct 12, 2007 3:15 pm

Don't you know that in smd format you can export only the legs or torso animation (preserving the Bip01 root), deleting the bones you don't need, to import them in a complete animated skeleton to override ony the imported bones? I think that the bone commands can't help you.
actually, i found that out a while ago but because my upper animations were longer than my lower animations the models had a nasty tendancy to fall throught the floor for a seccond during walking shooting animations.

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

Post by federico » Mon Oct 15, 2007 9:22 pm

Anyone?

MakerOfGames
Posts: 866
Joined: Fri Jul 08, 2005 4:27 am
Location: PA, USA

Post by MakerOfGames » Mon Oct 15, 2007 10:22 pm

I am incredibly impressed! I am so happy to see physics in RF. I should be able to make use of this with animation testing for my game! I am going to use a ragdoll "puppet" system to make all of the animations seamless for my game. I am going to use RF2 for my final game because RF isn't powerful enough to handle everything I want. However, your physics releases of RF will enable me to script players and test how animations will workout before then. Keep up the great work!
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis » Tue Oct 16, 2007 10:42 am

federico wrote:I need an artist who creates an arena level for me, detailed and graphically optimized.
I could give it a try. I'm still learning the tricks of level design, though, so the result may be not-so-great.

Do you have any ideas or details about what the level should be like?
There should be lots of stairs and other places where the ragdolls can fall down, right? :)
Pain is only psychological.

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 » Thu Oct 18, 2007 3:13 pm

i would reall like to test this. i am pretty good at making basic levels with basic gometry. my good levels run pretty well.
i was holding off on asking for this because i am doing a lot of colleage work and such. but i cant stand by and let an opprotunity like this pass me by.
just tell me what you need and i will do my best.
i assume that you are looking to have someone test the physics under many circumstances and find the flukes in the tests. am i right?

anyways i would love to give this a try.

thanks,
fps

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

Post by federico » Thu Oct 18, 2007 6:57 pm

I'm building a set of basic demos to show you example of the entities usage. It's a black box with 4 lights and some bsp artifacts. It's not a game demo, it's a demo for the RF developpers. So that part is made.
I would like to follow the integration of the physics in an existing project, to see some bugs and compatibility or performance issues. If someone is willing to integrate physics in his project I only ask to keep me informed.
I'm making the polish part so expect a release very soon (three, four days).




:wink:

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 » Thu Oct 18, 2007 7:24 pm

i will be sure to give it a good try.
i am incredibly excited to use the new physics.
i will keep you updated on my progress.

thanks,
fps
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
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico » Thu Oct 18, 2007 11:30 pm

Working on the primitive demo, bugfixing and polishing...

Video:
Image

User avatar
zany_001
Posts: 1047
Joined: Fri Mar 02, 2007 8:36 am
Location: Aotearoa

Post by zany_001 » Fri Oct 19, 2007 5:11 am

i must say its looking very gud right naow, especially the rugby ball...

NZ lost against FRANCE>>>>baaaaaaaaaaaaaaaaaaaaaaaaaaaaaahghghghg

i hope springbox wastes England....
Once I was sad, and I stopped being sad and was awesome instead.
True story.

User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA
Contact:

Post by darksmaster923 » Fri Oct 19, 2007 5:50 am

cool but it seemed to be lagging. most likey youtube.
Herp derp.

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

Post by federico » Fri Oct 19, 2007 9:04 am

there's lagging due to the sound playing and effect spouting. I'm still trying to understand how preload sounds effect.
Filling my struct in the PhysicsManager init it's not enough:

Code: Select all

        //Material effects
	if(stricmp(Mat->ImpactSound, ""))
	{
		geSound_Def *SoundDef1 = SPool_Sound(Mat->ImpactSound);
		Material[MatID].impactSound = SoundDef1;
	}
The first sound effect still makes the engine lag. There's a better procedure to pre-load media.

@QoD
Please help me with your experience.

Ryan
Posts: 161
Joined: Tue May 01, 2007 5:31 am
Location: Tucson Arizona

Post by Ryan » Fri Oct 19, 2007 3:27 pm

So this will be added to RF so all of us can use it?? or is it for RF2?
Those who have all the answers, are never up to date on the questions.

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

Post by federico » Fri Oct 19, 2007 5:34 pm

pure RF1.

RF2 is a surely wonderful but mysterious object. The relation between the two programs is simply non-existant.

Ryan
Posts: 161
Joined: Tue May 01, 2007 5:31 am
Location: Tucson Arizona

Post by Ryan » Sat Oct 20, 2007 2:52 am

awesome! Will the physics be easy to get into RF, or will it requre some reproraming
Those who have all the answers, are never up to date on the questions.

Post Reply