Kinematic Joint rotation is very slow

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Kinematic Joint rotation is very slow

Postby Julio Jerez » Thu Feb 28, 2019 8:36 am

oh I see what you are doing, you are applying a friction force and toque proportion to the speed of the body, which is more of less the speed of the mouse, since is try to catch up.

I like that method better, because it only become strong when it nee to be strong.


It need to be clarified a little, for example thsi does not make sence dAbs(dMax(-9.81f, 5.0f));
since it will always be 5.0, (I made the mistake too)
but I added it in under an if def, I will try to formalize later.


I like your method because, strong force are only need at fats speed, and usually there the motion hide any possible jitter, while when touching other bodies this happen at low speed and ridicules friction cause unnecessary jitter wich this method prevents.
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Joint rotation is very slow

Postby Dave Gravel » Thu Feb 28, 2019 10:08 am

Hi Julio, The method with the object velocity for get the speed is my first try.
This method can work not so bad, The problem with this method is exemple if a object is under a stack it become very hard to move the object. Because the object velocity is too low for generate the pick force.

I have modified my method for use only the mouse speed for generate the value.
In my demo the result is better with the mouse speed method.
In this zip you can see the modification where I get only the mouse speed and not the object velocity.

https://sites.google.com/site/oxnewton/MousePickModification.zip

PS: Yes I have see about dAbs(dMax(-9.81f, 5.0f)); I have forget to talk about it, and I have reproduce the error again..
--
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Kinematic Joint rotation is very slow

Postby Julio Jerez » Thu Feb 28, 2019 12:23 pm

I will check tonight,.
Mean time I think we can make an improvement to the joint.
Now there are two modes,
O-control position
1-full matrix.

Both method are deficient I think.
What is need it is a method that control the position like method one, but that add a dry friction to the orientation.
This method allows for the user to align the object but pushing against if he object to get a desired alignment.

Committed this as default and is now method 2

But setting the angular friction high or low some effect can be achieve.

Can you check it out,
Josh, if you read this I think this might interested you since you are on the virtual reality thing.
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Joint rotation is very slow

Postby Dave Gravel » Thu Feb 28, 2019 1:10 pm

I can't test for now.
I check it when I back at home.
Thanks.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Kinematic Joint rotation is very slow

Postby Julio Jerez » Thu Feb 28, 2019 3:37 pm

Ok, when you get time.
I think this is by far the most user friendly method yet, I find that I can do object placement very easy and usually I am a total moron what it come to editing stuff, usually of I can do it anyone can do it.

Please when you have time tell me if this can work for you.
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic Joint rotation is very slow

Postby Dave Gravel » Thu Feb 28, 2019 4:24 pm

My code commented out in the DemoCameraManager.cpp file is my first and old try method.
--
This one here is the one that I use in my current demo editor.
Code: Select all
if (m_pickJoint) {   
  dFloat Ixx;
  dFloat Iyy;
  dFloat Izz;
  dFloat mass;
  NewtonBodyGetMass(m_targetPicked, &mass, &Ixx, &Iyy, &Izz);

  dVector mousespeed(dVector(m_mousePosX, m_mousePosY, 0.0f));

  mousespeed -= m_mousebackup;

  float speed = dSqrt(mousespeed.m_x * mousespeed.m_x + mousespeed.m_y);

  if (speed < 100.0f) speed = 100.0f;

   //printf("%.3f \n", speed);
            
   dFloat angularFritionAccel = speed;
   dFloat linearFrictionAccel = (speed * 3.0f) * dAbs(dMax(DEMO_GRAVITY, 10.0f));
   dFloat inertia = dMax(Izz, dMax(Ixx, Iyy));

   m_pickJoint->SetMaxLinearFriction(mass * linearFrictionAccel);
   m_pickJoint->SetMaxAngularFriction(inertia * angularFritionAccel);
               
   m_pickJoint->SetTargetPosit (m_pickedBodyTargetPosition);
               
   m_mousebackup = dVector(m_mousePosX, m_mousePosY, 0.0f);
  }

--
I have test your change and from what I see the result is very similar to what I currently get with my demo.
I think it is pretty much the limit before get trouble with joints or with other collision bodies.
It's not perfect but for me when I move the objects I feel it better.

Please when you have time tell me if this can work for you.

For me and for general demos I think it is good and better with less lag.

I am a total moron what it come to editing stuff

I'm a winner for this too lol, In my case by repeating the same error many times before see it.

Yes it is easy to place the objects in the scene with this method.
If i'm not wrong you can apply the original forcecallback over it to let's a bit of gravity acting ?
Or for do this I need to use the mode 1 m_pickJoint->SetPickMode (1); ?
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://www.facebook.com/dave.gravel1
http://orionx3d.googlepages.com/
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 712
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Kinematic Joint rotation is very slow

Postby Julio Jerez » Thu Feb 28, 2019 5:44 pm

Dave Gravel wrote:If i'm not wrong you can apply the original forcecallback over it to let's a bit of gravity acting ?
Or for do this I need to use the mode 1 m_pickJoint->SetPickMode (1); ?


No, this is different. This method using position to control the position rows, but for the angular rows it simple try to make the velocity zero.
the body rotate only when the solver violate the angular row friction, so it act as a angular energy sink and its much less prompt to overshoot.

this mean that by setting the angular energy weak you can have a nice picking method.
and by station stronger it give you a nice object placement tool that is plastic to where the use apply the pressure.

you set it up by using the call
// set this to 1 for full matrix control
m_pickJoint->SetPickMode (2);
Julio Jerez
Moderator
Moderator
 
Posts: 10992
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Previous

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest