When i use raycast, sometimes execute filter for object, but not execute prefilter. Why?
For example in prefilter i write always return 0, but cast passed.
This bag or i not understand how prefilter work?
P.S. Newton 2.11 and 2.22.
Moderators: Sascha Willems, walaber
static unsigned RayCastPrefilter (const NewtonBody* body, const NewtonCollision* collision, void* userData)
{
return 0;
}
static dFloat RayCastFilter (const NewtonBody* body, const dFloat* normal, int collisionID, void* userData, dFloat intersetParam)
{
...
return intersetParam;
}
RayCastprefilter fo rteh first object.
if prefiler ==1 ) {
RayCast thet object.
if ( Ray hit the body an dteh ray can possible hit secudn body) {
if (Rayprefiler secund body) {
if ( Ray hit the body and the ray can possible hit secudn body) {
//and so on.
}
}
}
else {
if (Rayprefiler secund body) {
if ( Ray hit the body and the ray can possible hit secudn body) {
//and so on.
}
}
static unsigned MyRayCastPrefilter (const NewtonBody* body, const NewtonCollision* collision, void* userData)
{
return 0; // Always zero - never executed MyRayCastFilter
}
static dFloat MyRayCastFilter (const NewtonBody* body, const dFloat* normal, int collisionID, void* userData, dFloat intersetParam)
{
// If cast passed, set position of box to (0,5,0)
dMatrix matrix (GetIdentityMatrix());
matrix.m_posit = dVector(0, 5, 0, 1);
NewtonBodySetMatrix(body, &matrix[0][0]);
return intersetParam;
}
Julio Jerez wrote:I do no knwo what teh demo does, I see 4 boxes and when I hit P one box disapare and anothe goes up in the air.
Users browsing this forum: No registered users and 1 guest