A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by dpadam450 » Wed Aug 27, 2008 7:35 am
I guess I don't understand all the parameters here. I have 2 boxes. No matter which box I shoot, the first box moves, even when I am shooting only the second box. I have checked and the callback is only hitting 1 box at a time, so I don't know what to do.
- Code: Select all
float RayCastPlacement(const NewtonBody* body, const dFloat* normal, int collisionID, void* userData, dFloat intersetParam)
{
dFloat* paramPtr;
dFloat mass;
dFloat Ixx;
dFloat Iyy;
dFloat Izz;
float omega[] = {0.0f, -1.0f, 0.0f};
//NewtonBodySetForce( body, &omega[0]);
picked = (NewtonBody*)body;
// I pass in time as user data
// I set time to the current intersection time
paramPtr = (dFloat*)userData;
paramPtr[0] = intersetParam;
return intersetParam;
}
.........
- Code: Select all
NewtonWorldRayCast (nWorld, P1, P2, RayCastPlacement, &time, NULL);
if(picked != NULL)
{
//This makes a box move in the bullet direction
NewtonBodySetForceAndTorqueCallback(rigidBodyBox, PhysicsCallBackBullet);
}
-
dpadam450
-
- Posts: 7
- Joined: Mon Jun 23, 2008 10:02 pm
by Aphex » Wed Aug 27, 2008 7:53 am
Are you returning zero from the RayFilterCallback? That will stop the trace after the first hit.
-
Aphex
-
- Posts: 144
- Joined: Fri Jun 18, 2004 6:08 am
- Location: UK
-
by dpadam450 » Wed Aug 27, 2008 4:44 pm
Sorry, I was coding till 4am last night and made a mistake. I was changing box1s torque callback rather than the picked pointer.
-
dpadam450
-
- Posts: 7
- Joined: Mon Jun 23, 2008 10:02 pm
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 24 guests