yes, that's a good explanation of how it work is good enough and fix with what is tought at any good high school physics curriculum.
in newton there are two function you can use to store application data, with a collision shape that you can them later get from each contact in the call back
- Code: Select all
typedef union
{
void* m_ptr;
dLong m_int;
dFloat m_float;
} NewtonMaterialData;
typedef struct NewtonCollisionMaterial
{
dLong m_userId;
NewtonMaterialData m_userData;
NewtonMaterialData m_userParam[6];
} NewtonCollisionMaterial;
void NewtonCollisionGetMaterial (const NewtonCollision* const collision, NewtonCollisionMaterial* const userData);
void NewtonCollisionSetMaterial (const NewtonCollision* const collision, const NewtonCollisionMaterial* const userData);
where NewtonCollisionMaterial has two data values with this own interface functions, some of these are used by some of the classes in the dJoint library , but there are 6 extra user data that you can use to store data for your logic.
In theh early days of newton, this was at the NewtonBody level, but I realized that is was too high granulation and inflexible, so I added this new layer for more flexibility without adding the handling of internal graph manipulation. It is better to let the end application do that with hash or maps.
This was one for the aspect of Newton that was criticized a great deal from the Internet physics experts like ODE, GameDevNet and places like that bringing the slippery slope argumentation that having two ids lead to a full graphs, when the reality is that this is the correct way of doing it, and in practice the number of material is quite small, so the graph is not large.
plus even when there are a large number of materials, an application can always limit the number and use defaults for not existing entries.
what bothered me at the time was that the people making these claims where the leaders and moderators and they must knows they were lying to their users to protect the way people like Novodex and ODE where doing this. It was all dishonesty.