Forcing body to position/orientation

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Forcing body to position/orientation

Postby PJani » Wed Sep 19, 2012 9:56 am

Hey, i know i can use kinematic joint for this type of job, but I need it to be forced with certain force, torque to position, orientation.

Maybe i overlooked some function in kinematic joint.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Forcing body to position/orientation

Postby Julio Jerez » Wed Sep 19, 2012 11:25 am

what are you doing?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Forcing body to position/orientation

Postby PJani » Wed Sep 19, 2012 2:34 pm

I will try to experiment with combining character animation and physics. If character falls or hits walls it will try to follow the animation.

The problem here is all of the animations(mocap data) already have moment of inertia, mass counted into movement of bones.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Forcing body to position/orientation

Postby Julio Jerez » Thu Sep 20, 2012 1:51 pm

you will have to do an inverse dynamics calculateion.

basically you take the velocities and angular velocity changes,
from step to step, and calculate an impulse that will achive that velicity changes.
then you apply that impulse to each body.

people some time call this techinque "soft keyframing" and wh ateh do s that the apply a forction of te himpulse,
that way the key frame and the phyically driven skeleton has some sort of phase angle.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Forcing body to position/orientation

Postby PJani » Thu Sep 20, 2012 3:38 pm

Huh tnx for the info :D,

I have problem with plain(without the use of anything but just bodies and limit ball and socket joints) ragdoll exploding. I have disabled all the collisions between all bodies representing the ragdoll. I don't know why ragdoll starts to oscilate and then explode, launching it self into air.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Forcing body to position/orientation

Postby Julio Jerez » Fri Sep 21, 2012 8:59 am

di they explode even if no force is applied?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Forcing body to position/orientation

Postby PJani » Fri Sep 21, 2012 10:20 am

The only force applied is gravitational force(my character weights exactly 81.56kg and each body part has density of 968kg/m^3 ), sometimes when "he" hits the floor he explodes. When my "skeleton" lies on floor a lots of oscillations happen( i almost s*** my pants yesterday when character started to "dance" to music 0_0 i was listening (of course because of oscialltions) ).

I finally binded physics to ogre skeleton using only orientations.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Forcing body to position/orientation

Postby PJani » Fri Sep 21, 2012 4:34 pm

Anyway i have another problem with hinge and limitballandsocket joint limits.

When limit is bigger than 90 degrees(1.57....radians) it fails to limit what ever limit is set(min/max twist limit, cone limit, min/max angle limit)
Last edited by PJani on Fri Sep 21, 2012 4:38 pm, edited 1 time in total.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Forcing body to position/orientation

Postby JoeJ » Fri Sep 21, 2012 4:37 pm

PJani wrote:I finally binded physics to ogre skeleton using only orientations.


... does that mean, the oscillation happens because you're trying to follow animation?
If you do nothing to the ragdoll except gravity, is there oscillation too?
It's a little confusing, because you say there is no other force except gravity,
but also you say its binded to animated skeleton, if i get that right.
How do you do that 'binding'?

To follow animation, you could do:
1. Find the targe pos. / orn. for the next frame using animation.
2. Calulate lin. and ang. velocities to reach that target, like Julio suggested.
3. Optional: Convert that velocities to forces / torques if that's responsive enough for you, see
http://newtondynamics.com/forum/viewtopic.php?f=9&t=7193
That gives better results in the case where the animated targets are impossible to reach (obstacles), like you describe.
4. Do some more stuff to make it realistic: Use max values for the forces, etc...

You may need to tune between exact animation matching and better obstacle behaviour,
but i know all that works without explosions, jittering should be very small.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Forcing body to position/orientation

Postby JoeJ » Fri Sep 21, 2012 4:42 pm

When limit is bigger than 90 degrees it fails to limit what ever limit is set(min/max twist limit, cone limit, min/max angle limit)


I solved that using my own custom joint.
Julio uses vector directions, which is not really good because the flipping.
I replaced that by a quaternion twist / swing, which allows > 150 degrees.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Forcing body to position/orientation

Postby PJani » Fri Sep 21, 2012 4:54 pm

No no, you got me wrong...with that i meant i am driving visual mesh/bones with quaternion orientations(only root bone is driven by position and quaternion orientation),
This is what i meant:
currently code is very very dirty and slow.
Code: Select all
            //m_skeleton is visual skeleton/entity
            //cc is physical bone( body ) from physical ragdoll
            Ogre::Bone* bone = dynamic_cast<Ogre::Bone*>(m_skeleton->getSkeleton()->getBone( cc->getName() )->getParent());
            if(bone)
            {
               bone->setManuallyControlled(true);
               bone->setInheritOrientation(false);
               bone->setOrientation(cc->getPhysicsQuaternion() * cc->getBodyInvOri());
            }


Debug mesh shows same problems without the ogre skeleton mesh! I repeat i am not applying any animations AT ALL! The only force is gravitational! And bodies are connected with joints!

My pipeline for ragdoll animation is following... its sub divided into few stages
Image

Oscillations happen because of joints, i think.
Last edited by PJani on Fri Sep 21, 2012 5:05 pm, edited 4 times in total.
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Forcing body to position/orientation

Postby PJani » Fri Sep 21, 2012 4:56 pm

JoeJ wrote:
When limit is bigger than 90 degrees it fails to limit what ever limit is set(min/max twist limit, cone limit, min/max angle limit)


I solved that using my own custom joint.
Julio uses vector directions, which is not really good because the flipping.
I replaced that by a quaternion twist / swing, which allows > 150 degrees.



Thank you JoeJ :D :mrgreen:
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Forcing body to position/orientation

Postby JoeJ » Fri Sep 21, 2012 5:05 pm

Ok, i'll download newest newton to verify if my ragdoll-stuff still works.
One quick test you could do is: Set uniform inertia to all bodies: BodySetMassMatrix (body, mass, mass, mass, mass);
But that's only guessing... :)
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Forcing body to position/orientation

Postby PJani » Fri Sep 21, 2012 5:06 pm

Thats is no more possible you will see ;D
| i7-5930k@4.2Ghz, EVGA 980Ti FTW, 32GB RAM@3000 |
| Dell XPS 13 9370, i7-8550U, 16GB RAM |
| Ogre 1.7.4 | VC++ 9 | custom OgreNewt, Newton 300 |
| C/C++, C# |
User avatar
PJani
 
Posts: 448
Joined: Mon Feb 02, 2009 7:18 pm
Location: Slovenia

Re: Forcing body to position/orientation

Postby JoeJ » Fri Sep 21, 2012 5:40 pm

No dancing :? If i turn off 'life' the dead ragdoll falls nicely down an comes to rest without jitter.
Animation matching of running also still works as usual.
I don't think the joint lib has changed the last time? (you aren't using the old build in joints?).
I'm using only own custom joints, try to build the Demo Sandbox's ragdolls - for me it does not build because missing opencl.dll
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests