Best joint for 2D physics?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Best joint for 2D physics?

Postby Leadwerks » Thu Oct 31, 2019 5:12 am

I was thinking about using the upvector joint for 2D physics but I still need to lock the position to a plane. Does the Custom Plane joint do this, or is there another way?
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Best joint for 2D physics?

Postby Dave Gravel » Fri Nov 01, 2019 11:11 pm

Hi Leadwerks,

It make many years I see you in the forum.
I have already see you post many good stuff that you have already done.
I remember to have see you working with joints before.

The customjoint lib is open source with some comments inside for help to say what the joint and rows doing.
With the times you have surely already make or test to make personal customjoint.
I think you are supposed to know how it work or have a good idea about how it work.

With all this years, You never have try to make a customjoint and use the row system ?

If you never have try the joint that you talking about, It have a very simple source in exemple.
Maybe you can just try and if it is not exactly what you need.
After you can ask the good question and say what is not working the way you like.
Or ask about how to fix the problem, It take around 5mins or 10mins to look at the code and try in your engine.

I don't try to become a heavy weights over your post.
I just try to understand what happen,
The newton sdk have change at the point to not understand anymore how it work ?
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Best joint for 2D physics?

Postby Leadwerks » Sat Nov 02, 2019 12:13 pm

I have no idea why you are replying to my all questions telling me I should not be asking the question. I don't understand how the custom joints system works. I have been working on a new engine with Vulkan for two years and I am wrapping up the physics features now. I want to include a couple of 3D-in-2D examples and I was wondering what the best way to add support for this is.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Best joint for 2D physics?

Postby Dave Gravel » Sat Nov 02, 2019 3:09 pm

I never say to don't ask any question.
The joint is very simple to use.
I just don't understand why you don't try it before ask the question.
Like I have say it take 5,10 mins to test and after you can give better informations if it don't work the way you like.
It is just more long to turn around a subject if you don't try it first.
You know better what you need and by trying first you can see better if it do what you need or not.

I have see you use the joints before, I have think that you know more about how to use it.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Best joint for 2D physics?

Postby JernejL » Sun Nov 03, 2019 4:52 am

Leadwerks: An upvector joint is the best way to start from.

I use this for my characters, and it can be adapted to add linear rows to also limit movement on the (2-d plane depth) aswell.

So.. a upvector joint will limit your 2d body rotations to just 1 axis (angular constraint), and then you just need to limit the freedom of movement (linear constraints) axis aswell.

So, old api this was NewtonConstraintCreateUpVector, in joints library there is a new example how to make that via NewtonConstraintCreateUserJoint.

http://www.newtondynamics.com/wiki/inde ... AngularRow
http://www.newtondynamics.com/wiki/inde ... dLinearRow

Custom joints library:

https://github.com/MADEAPPS/newton-dyna ... stomJoints

What you need to combine is dCustomUpVector + dCustomSlider

I do agree that an example of "2d plane joint" would be a good thing to have in newton.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Best joint for 2D physics?

Postby Leadwerks » Mon Nov 04, 2019 12:44 pm

Have not tried it yet, but it appears a plane joint does exactly what I want.
Image
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Best joint for 2D physics?

Postby Leadwerks » Thu Nov 07, 2019 4:17 am

I am trying the CustomPlane joint and I get a crash on this line of NewtonClass.cpp when I use it:
Code: Select all
dgUnsigned32 NewtonUserJoint::JacobianDerivative (dgContraintDescritor& params)
{
   m_rows = 0;
   m_param = &params;
   m_jacobianFnt ((NewtonJoint*)this, params.m_timestep, params.m_threadIndex);// crash!
   return dgUnsigned32 (m_rows);
}
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Best joint for 2D physics?

Postby JernejL » Thu Nov 07, 2019 8:37 am

can you post a call stack for the crash itself?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Best joint for 2D physics?

Postby Dave Gravel » Thu Nov 07, 2019 4:59 pm

Here in my test the joint look to work ok.
https://www.youtube.com/watch?v=4Bk_F777i9s

I get only problem in debug mode because it have a assert in the joint submit.
Maybe Julio have forget to remove it, Or the joint implementation is not 100% tested.

Do you make something special for get this error ?
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Best joint for 2D physics?

Postby Leadwerks » Sat Nov 09, 2019 4:52 am

Dave Gravel wrote:Here in my test the joint look to work ok.
https://www.youtube.com/watch?v=4Bk_F777i9s

I get only problem in debug mode because it have a assert in the joint submit.
Maybe Julio have forget to remove it, Or the joint implementation is not 100% tested.

Do you make something special for get this error ?

Ah, the Assert call was the problem. It works fine when I remove that.

This joint is very fun to play with. It's exactly what I was looking for.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Best joint for 2D physics?

Postby Julio Jerez » Sun Nov 24, 2019 5:30 pm

I added a demo for a 2d mini game.
is shows how joint should be set up for more accuracy, efficiency and robustness.

one of the benefic of using a 3d engine for 2d games is that, 2d game are no long the scrollers they use to be. they now have 3d and with a 3d engine thsi come naturally.

thing liek paraller planes and 2 1/2 dimension are a given while using a 2d physics solution this is near impossible.

on the other side a 2d physics engine is much faster sine it onel deals with 3 x 3 matrices, but in today technology I can't see a 2d game developer using a 2d engine for performance reason.
although I would no be surprise to find fanatics out there that will make that case.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 16 guests

cron