2 KinematicBodies not colliding Newton 3

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

2 KinematicBodies not colliding Newton 3

Postby Lax » Sun Jun 12, 2022 6:04 am

Hi,

I'm using the latest Newton 3 version and have a simple scenario, in which I have 2 kinematicbodies.
But somehow they do not collide anymore. As far as I remember. It worked in the past.

Strangly in the debug modus, as soon as I start my simulation. I get the following assert:

Code: Select all
void dgSkeletonContainer::Finalize(dgInt32 loopJointsCount, dgBilateralConstraint** const loopJointArray)
{
   dgAssert(m_nodeCount >= 1);

   const dgDynamicBody* const rootBody = m_skeleton->m_body;
   dgAssert (((rootBody->GetInvMass().m_w == dgFloat32 (0.0f)) && (m_skeleton->m_child->m_sibling == NULL)) || (m_skeleton->m_body->GetInvMass().m_w != dgFloat32 (0.0f)));

It says that the m_skeleton->m_child is NULL how can that be? I tried the kinematicbodies demo, and in this demo finalize is never called. Why is it called in my simulation?

I also set for both kinematic bodies:
Code: Select all
NewtonCollisionSetMode(collision, 1)


and I integrate the velocity for both bodies.

I hope someone can help on this issue!

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: 2 KinematicBodies not colliding Newton 3

Postby Julio Jerez » Sun Jun 12, 2022 12:02 pm

Are you trying to attach joints to kinematic bodies?
That is not allowed in 3.xx

In 4.00 is but that's because all bodies are kinematic.
Still two kinematic bodies do not collide.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 2 KinematicBodies not colliding Newton 3

Postby Lax » Sun Jun 12, 2022 2:45 pm

No, I do not attach joints. Just want to collide two characters and react on collision.

Still two kinematic bodies do not collide.

Do you mean, it is not possible, that 2 kinematic bodies collide?
So there must be one rigid body involved?
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: 2 KinematicBodies not colliding Newton 3

Postby Julio Jerez » Sun Jun 12, 2022 4:20 pm

Lax wrote:Do you mean, it is not possible, that 2 kinematic bodies collide?
So there must be one rigid body involved?


yes, they never had in 3.xx

if you look at function
void dPlayerController::ResolveCollision(dPlayerControllerContactSolver& contactSolver, dFloat timestep)

you will see that it calculates collision of the player by itself, not as end engine narrow phase function.

this also apply to 4.00, however in 4.00 player and triggers are sdk class objects so for the app view point they collide with players and triggers and any other body because they are part of the broad phase and calculate the contacts.

this is possible in 4.00 because the update happens after contacts are calculated while in 3.xx
after contacts are calculated what follows is the contact resolution (solver), so there is not chance for the engine to process special objects like players, triggers, vehicles, etc.

are you using dPlayerController?
is so them players should collide with other players.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 2 KinematicBodies not colliding Newton 3

Postby Lax » Mon Jun 13, 2022 2:30 pm

Hi Julio,

thanks for clarification!

are you using dPlayerController?
is so them players should collide with other players.


No I didn't but in that case I will use the player controller.

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: 2 KinematicBodies not colliding Newton 3

Postby Julio Jerez » Mon Jun 13, 2022 10:47 pm

has you tried 4.00
I solve many of the issue that you might be having, and it is a lot easier to use than 3.xx
for once is full c++, so not more dreaded c++ callbacks
and player controller work so much better, so if you are going to make that kind of change, give it a try to 4.00
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 2 KinematicBodies not colliding Newton 3

Postby Lax » Wed Jun 22, 2022 4:08 am

has you tried 4.00
I solve many of the issue that you might be having, and it is a lot easier to use than 3.xx
for once is full c++, so not more dreaded c++ callbacks
and player controller work so much better, so if you are going to make that kind of change, give it a try to 4.00


Unfortunately not. Because I would need to re-write the whole OgreNewt. And I'm afraid in doing that. Because in the past. I got an almost finished OgreNewt and just adapted lots of thinks. But I have no idea how re-write everything. I also do not have that time anymore :(.

Or has somebody in the community start to re-write OgreNewt to newton 4.0?

Back to the issue:
- I created now 2 player controller. At least they do collide. But I get no contact data, that the collision occurred. Is this also not possible?
I need to react, when the two player controller collide.
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: 2 KinematicBodies not colliding Newton 3

Postby Julio Jerez » Wed Jun 22, 2022 7:44 am

oh, I see OgreNewt


ok, now that you have the player, it is like normal cpp programing, you subclass form the basic player
and you override the methods that you wnat to customize.

in the demo, file ..\newton-3.14\applications\demosSandbox\sdkDemos\demos\BasicPlayerController.cpp
does that
function
dFloat ContactFrictionCallback(const dVector& position, const dVector& normal, int contactId, const NewtonBody* const otherbody) const

will be called on collision, and you get the secund body.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 2 KinematicBodies not colliding Newton 3

Postby Lax » Wed Jun 22, 2022 9:12 am

Ok thanks for the infos!
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: 2 KinematicBodies not colliding Newton 3

Postby Julio Jerez » Wed Jun 22, 2022 7:31 pm

u
Lax wrote:Or has somebody in the community start to re-write OgreNewt to newton 4.0?


I am familiar with the first version of OgreNewt. I helped Wallaber write it about 15 years ago,

Maybe I can make that update, and added to some git hub branch
I downloaded Ogree, and I see that the cmake script can make the solution much easier that in the pass.
But I could not find any link to OgreNewt, In the Ogree forum I see that all question are redirected to a channel that not one reads. so how to I get OgreNewt?

I was able to build after disabling some pugins. but the after that no sure how to add OgreNewt.
I assume is some kind of component
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: 2 KinematicBodies not colliding Newton 3

Postby Lax » Thu Jun 23, 2022 3:04 am

Hi Julio,

I have the newest OgreNewt version, which is working with the newest Ogre 2.x version.
You can download everything here:

https://sourceforge.net/p/nowa-engine/svn/HEAD/tree/external/
See OgreNewt3_0 folder.

There is also lots of code how I use OgreNewt. I did not change since the last 15 years.

Another question:
In my Player Controller, which is derived from dCustomPlayerControllerManager I'm using:
Code: Select all
virtual dFloat ContactFriction(dCustomPlayerController* const controller, const dVector& position, const dVector& normal, int contactId, const NewtonBody* const otherbody)

This called and working fine. But the function:
Code: Select all
virtual bool ProccessContact(dCustomPlayerController* const controller, const dVector& position, const dVector& normal, const NewtonBody* const otherbody) const

Is never called, so I cannot react when 2 player collided. Is there a bug?

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: 2 KinematicBodies not colliding Newton 3

Postby Dave Gravel » Thu Jun 23, 2022 4:18 am

Hi Lax,
I have take a quick look in the OgreNewt3_0 code.
From what I see the player implementation is not UpToDate for use with the last newton 3.14.

I think the ProccessContact don't exists anymore in the last version, Or it is implemented differently with a other name.

I think now it use something like:
PreUpdate
PostUpdate
Take a look in this file (dPlayerController.h, .cpp) you can see how it is implemented in the last newton 3.14 version.
AdvancedPlayerController.cpp
AnimatedPlayer.cpp

Look at this implementation class too.
class dAdvancedPlayerController: public dPlayerController

I think the vehicle or any other controllers implementation in OgreNewt3_0 can need similar updates for work correctly.
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: 2 KinematicBodies not colliding Newton 3

Postby Lax » Thu Jun 23, 2022 4:56 am

Hi Dave,

Oh yes, you are right. I'm still using the old system und will upgrade.
Thanks for pointing it out!

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: 2 KinematicBodies not colliding Newton 3

Postby Lax » Thu Jun 23, 2022 6:30 am

Ok, I adapted the player controller to derive correctly and movement is working.
But know I have a big issue. I'm using now the correct:

Code: Select all
dFloat ContactFrictionCallback(const dVector& position, const dVector& normal, int contactId, const NewtonBody* const otherbody) const


It also works for one player controller and rigid bodies. But It does not detect, if a player controller collided with another player controller, which inside is a kinematic body. The collision detection itself does work, the other player will be moved away if I collide with it, but ContactFrictionCallback is not called.
How can this be fixed?

Another question: As I have two player controller. Should I have just one PlayerControllerManager which is adding a PlayerController with AddRoot(...) 2 times? Or can each PlayerController can have its own PlayerControllerManager?

Best Regards
Lax
Please support SecondEarthTechnicBase built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd17-5ff5-40a0-ac6f-44b97b79be62
Image
Lax
 
Posts: 165
Joined: Sat Jan 08, 2011 8:24 am

Re: 2 KinematicBodies not colliding Newton 3

Postby Julio Jerez » Thu Jun 23, 2022 10:59 am

Lax wrote:Hi Julio,

I have the newest OgreNewt version, which is working with the newest Ogre 2.x version.
You can download everything here:

https://sourceforge.net/p/nowa-engine/svn/HEAD/tree/external/
See OgreNewt3_0 folder.

Lax


Cool, is that you game?

I will lift igrenewt3 ans see if I can make an ogrenew4 from it with the same interface or as close as possible.
So this way should be a drop in.
Newton 4 can coexist with older versions, so the risk should be very minor.

I see if I do ot over the weekend and load it with the sdk in a folder.
I was think of doing thar for some time, so maybe I start with old ogree.

You say this is ogre 2. But what I download in the ogre forum say agree 13.

Am I getting something wrong?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 19 guests