Tires popping up on flat terrain

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Tires popping up on flat terrain

Postby JoshKlint » Thu Dec 20, 2018 4:08 pm

Okay, here is my fix.

NewtonCustomerSliderActuator.cpp:
Code: Select all
void dCustomSliderActuator::SubmitAngularRow(const dMatrix& matrix0, const dMatrix& matrix1, dFloat timestep)
{
   dCustomSlider::SubmitAngularRow(matrix0, matrix1, timestep);
   if (m_maxForce <= 0.0f) return; //add this line![/


NewtonCustomHingeActuator.cpp:
Code: Select all
void dCustomHingeActuator::SubmitAngularRow(const dMatrix& matrix0, const dMatrix& matrix1, const dVector& eulers, dFloat timestep)
{
   dCustomHinge::SubmitAngularRow(matrix0, matrix1, eulers, timestep);
   if (m_maxTorque <= 0.0f) return; //add this line!


This allows you to make a motorized joint that can go slack, or in my case we just have one hinge and one slider joint, with a command to enable or disable the motor.

I request this be added in the official source. What do you think?
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby Julio Jerez » Thu Dec 20, 2018 4:40 pm

it is cpp you can overload that
Code: Select all
class MySlider : public dCustomSliderActuator
{
   ....
   ....

      void SubmitAngularRow(const dMatrix& matrix0, const dMatrix& matrix1, dFloat timestep)
   {
      if (m_maxForce <= 0.0f) {
         dCustomSlider::SubmitAngularRow(matrix0, matrix1, timestep);
      } else {
         dCustomSliderActuator::SubmitAngularRow(matrix0, matrix1, timestep);
      }
   }
};
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Tires popping up on flat terrain

Postby JoshKlint » Thu Dec 20, 2018 5:49 pm

Did something change in the terrain AABB calculation? None of my objects are colliding with terrain now.

I don't see any big changes in the heightfield collision file, so I am not sure why this is happening.
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby Julio Jerez » Thu Dec 20, 2018 6:11 pm

I have no made any changes that can change that, there are terrain demos in the sandbox.
Newton 3.14 not longer uses aabb or obb for pruning is all closest distance based.
if a body in on top of a terrain is should always fail the test and report a pair.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Tires popping up on flat terrain

Postby JoshKlint » Thu Dec 20, 2018 7:42 pm

I'm getting the Overlap() callback, but not the contacts callsback.

Raycasts on the collision object seem to work fine.
Last edited by JoshKlint on Thu Dec 20, 2018 10:07 pm, edited 1 time in total.
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby JoshKlint » Thu Dec 20, 2018 9:31 pm

My terrain is always offset by half the terrain size, but the matrix when I create the body does not seem to do anything...
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby JoshKlint » Thu Dec 20, 2018 9:58 pm

I found the cause.

If you call NewtonBodySetCollision() with a heightfield collision, you must call NewtonBodySetMatrix() afterwards.

I do not know if this happens with other types of collision shapes.
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby Julio Jerez » Thu Dec 20, 2018 10:34 pm

But that's always the case, if you change the shape of a body, it needs to be reposition in the broadphase.
It can't be done automatically because a shape can bet for other reasons.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Tires popping up on flat terrain

Postby JoshKlint » Thu Dec 20, 2018 10:48 pm

I think this was not previously required in the old version I had.

Anyways it's fixed, everything else seems to work okay, and I can move on with the vehicle. I expect to be able to finish this around the first or second week of January.
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby Julio Jerez » Thu Dec 20, 2018 11:30 pm

Is the edge bug fixed?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Tires popping up on flat terrain

Postby JoshKlint » Fri Dec 21, 2018 2:51 am

I have not been able to implement the changes to use the new functionality yet. But at least I can go forward with that now.
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby JoshKlint » Fri Dec 21, 2018 1:13 pm

There are five different vehicle demos in the sandbox. Which one should I be looking at?

--

Ah okay, it is the basic multibody vehicle demo...
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby JoshKlint » Fri Dec 21, 2018 1:50 pm

I don't understand what is happening here:
Code: Select all
dCustomTireSpringDG* const tireJoint = (dCustomTireSpringDG*)collisionMaterial.m_userData;
      dAssert(tireJoint->GetBody1() == ((id0 == D_MULTIBODY_TIRE_ID) ? body0 : body1));

      dMatrix tireMatrix;
      dMatrix tireHarpointMatrix;
      tireJoint->CalculateGlobalMatrix(tireHarpointMatrix, tireMatrix);


Is the tire collision just being calculated by a straight-down convex raycast?
Attachments
Untitled.jpg
Untitled.jpg (67 KiB) Viewed 9301 times
JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

Re: Tires popping up on flat terrain

Postby Julio Jerez » Fri Dec 21, 2018 2:58 pm

Is a convex cast from the tire hard point along the suspension axis.
In a way is like a convex or ray cast car but that's where the similarity stops.

It does not move the tire it just find the first contact on the ground and set the contact on the surface of the tire objects considering penetration and tire shape.

speaking of shape, I know people like to use shapes like cylinder, sphere or even convex shape to model tire. just because they work does not mean will lead to a proper vehicle tire model.

all macro tire models that I know are designed using the concept the tires touch the floor at one contact point in the middle of a contact patch.
Form that they deduce the longitudinal, lateral and aligning torque based of longitudinal and lateral slip ratios. if you use a cylinder those assumptions goes out of the window.

from the engine point of view the chamfered cylinder collision if far more efficient than a cylinder with hard edges, plus it only generate one contact that passes through the tire center.

there are lot of of rational justifications for using the chamfered cylinder and practically zero for using other shapes other than been able to say you can use any shape for tire.
but if you do you will be like these guys https://www.youtube.com/watch?v=CIN8Q_4iaxU
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Tires popping up on flat terrain

Postby JoshKlint » Sat Dec 22, 2018 3:30 pm

I am working on this...it will take some time to figure out.

I have another problem with the tires. When they start going fast they no longer spin on the hinge / axle. The ground here is a triangle collision mesh, not a terrain.

JoshKlint
 
Posts: 163
Joined: Sun Dec 10, 2017 8:03 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 16 guests