Moderators: Sascha Willems, walaber
Sweenie wrote:Saw you made NewtonMaterialInteraction reference two NewtonMaterial objects.
Did that work? Can one asset reference another?
var materials = Resources.FindObjectsOfTypeAll(typeof(NewtonMaterial));
var matPairs = Resources.FindObjectsOfTypeAll(typeof(NewtonMaterialInteraction));
Debug.Log("Materials found: " + materials.Length);
foreach(NewtonMaterial mat in materials)
{
Debug.Log(mat.name);
}
Debug.Log("MaterialInteractions found: " + matPairs.Length);
foreach (NewtonMaterialInteraction matPair in matPairs)
{
Debug.Log(matPair.name + " K:"+ matPair.m_kineticFriction + " S:"+matPair.m_staticFriction);
}
Resources.LoadAll("NewtonMaterials");
void dNewtonWorld::OnContactCollision(const NewtonJoint* contactJoint, dFloat timestep, int threadIndex)
{
NewtonBody* const body0 = NewtonJointGetBody0(contactJoint);
NewtonBody* const body1 = NewtonJointGetBody1(contactJoint);
// dNewtonBody* const dbody0 = (dNewtonBody*)NewtonBodyGetUserData(body0);
// dNewtonBody* const dbody1 = (dNewtonBody*)NewtonBodyGetUserData(body1);
// dbody0->m_onCollision(dbody1);
// dbody1->m_onCollision(dbody0);
void OnCollision(IntPtr otherBody)
{
Debug.Log("collision"); // This works
//Debug.Log("collision " + this.gameObject.name); // This cause Unity to hang
}
// I do not know how to get a NewtonBody from a dNetwonBody, ideally a reference can be save with the NewtonBody
// public void OnCollision(NewtonBody otherBody)
public void OnCollision(dNewtonBody otherBody)
Users browsing this forum: No registered users and 22 guests