Jump to content

Physic system ?


YouGroove
 Share

Recommended Posts

Well i am beginner and little confused !

 

I see Newton Dll on the installation directory , and when watching collision commands i see some functions dealing with Flags and numbers instead of Physics commands ?

So my question is what do i have to use to for example detect collision detection between models and raycasting ?

Or when should we use the simple system and when should we invoke Newton physic functions (throught some C++ Binding ?) ?

Stop toying and make games

Link to comment
Share on other sites

You give them EntityTypes which is a number. Then you call the Collisions() function passing in the 2 entity types as the first 2 params then the last param is what kind of collision you want to happen.

 

So assign entity type 1 to terrain

Then assign entity type 2 to a body

Then call Collisions(1, 2, 1)

The last number is the kind of response you want. The doc has their meanings for what value.

 

 

So basically you setup all your collisions between all your bodies like this.

Link to comment
Share on other sites

Each collision needs a number, but of course you shouldn't use numbers directly in your C++ program, but define them with meaningful #defines.

Like:

#define terraintype 1

#define playertype 2

#define cartype 3

etc....

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Each collision needs a number, but of course you shouldn't use numbers directly in your C++ program, but define them with meaningful #defines.

Like:

#define terraintype 1

#define playertype 2

#define cartype 3

etc....

Here is another way to do it

enum Collisions
{
    TerrainColl =1,
    PlayerColl,
    CarColl, 
    ...
    ...     
    ...
};

Collision( TerrainColl, PlayerColl );

AV MX Linux

Link to comment
Share on other sites

Thanks guys !

I'll use simple Raycasting and collision detection between models so Newton commands are not needed !

It means that we use simple commands, but behind it's the physic engine Newton that manages all that is running ?

 

I've seen some move functions for entities, i think it don't uses physic engine for moving entities ? something similar to AddForce ?

Or is it used behind the black box :D ?

Stop toying and make games

Link to comment
Share on other sites

Physics movement is completely seperated from mesh movement, but you can position the mesh where the physics body is. Using the SetEntityParent command the engine does this positioning automatically.

 

You can however move physics bodies also with mesh movement commands, in which case the physics force is set to 0 for the affected axes. This means also that you can for example move a physics body along one axis with mesh commands, and its physics force is still working on the other 2 axes.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Thanks guys !

I'll use simple Raycasting and collision detection between models so Newton commands are not needed !

It means that we use simple commands, but behind it's the physic engine Newton that manages all that is running ?

 

Unless you are writing your own raycast functions, you will still need Newton. In fact, I don't think the engine even starts without the DLL present.

Link to comment
Share on other sites

In fact, I don't think the engine even starts without the DLL present.

 

It doesn't - and you need JointLibrary.dll as well. Confusing when you use your own version of Newton 2.25, which has renamed it to dJointLibrary.dll

 

It's so tempting to get rid of the other redundant one but you just can't...

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...