Stratos: Punto de Encuentro de Desarrolladores

¡Bienvenido a Stratos!

Acceder

Foros





WorldRayCast

Iniciado por Iron_Wardog, 06 de Julio de 2006, 09:43:49 PM

« anterior - próximo »

Iron_Wardog

Can someone tell what cb and cb2 are supposed to be (semantically) in

public extern static void WorldRayCast(int newtonWorld, ref Vector3 p0, ref Vector3 p1, WorldRayCastCB cb, object userData, WorldRayCastCB cb2);

Also, in Haddd.Physics.RayCast setting .OnlyMass0 to false is irrelevant in the current version correct?

Haddd

Ummm...I think the engine is going to be open source soon and you can see all the code...(but you can now with a program, as you should know...)

Vicente

I aim to the end of this month. And I don´t see any reason to fail this date :)

About those parameters and function, no idea, I´ll look at them and tell you if the source gives more insight. Greetings!

Vicente

Vicente

Hi,


[DllImport("Newton.Dll", EntryPoint = "NewtonWorldRayCast")]
public static extern void WorldRayCast(int newtonWorld, ref Vector3 p0, ref Vector3 p1, WorldRayCastCB cb, [MarshalAs(UnmanagedType.IUnknown)] Object userData,WorldRayCastCB cb2);


So you should check the newton documentation about that one I think.

About the other question:


/// <summary>
/// Indicates that only 0 mass objects will be tested
/// </summary>
public bool OnlyMass0;


Changing it to false will make the raycast check with all objects, not only with objects with 0 mass.

Greetings!

Vicente

Iron_Wardog

I do not have the luxury of time to wait for the open source, unless u intend to release it in the following 2 days:

public virtual bool WorldRayCast(ref Microsoft.DirectX.Vector3 p0, ref Microsoft.DirectX.Vector3 p1, out System.Single parameter)
{
 Microsoft.DirectX.Vector3 vector3;
 HadddEngine.Haddd.Physics.RayCast.PlacementParameter = 1.1F;
 HadddEngine.Haddd.Physics.RayCast.OnlyMass0 = 1;

^- decompiled the WorldRayCast and i may be missing something (which was why i originally made the question) but it looks like the only is always being set to true and in my tests it never worked with non 0 bodies.

As for the Newton documentation:

void NewtonWorldRayCast(
const NewtonWorld* newtonWorld,
const dFloat* p0,
const dFloat* p1,
NewtonWorldRayFilterCallback filter,
void* userData)

it only has 1 callback, or is there some other function i neglected?

Haddd

The second parameter is added because when i release the last version, Newton had a new one too, and i changed the library calls, but not the engine for this new changes.

So, this parameter is not used at the Engine at the moment

Vicente

Hi!

the source will go live at the end of the month :( But let´s see if we can solve this:

Your method is like this:


/// <summary>
       /// Checks if there is any collision with the world
       /// </summary>
/// <remarks>You can check the <see cref="RayCast"/> property to know more info about the collision</remarks>
       /// <param name="p0">First ray point</param>
       /// <param name="p1">Last ray point</param>
       /// <param name="parameter">[0,1] value to know the intersection point</param>
       /// <returns>true if a there is a collision</returns>
       public bool WorldRayCast(ref Vector3 p0, ref Vector3 p1, out float parameter)
       {
Jad.Physics.RayCast.PlacementParameter = 1.1f;   // No collision
Jad.Physics.RayCast.OnlyMass0 = true;
Jad.Physics.RayCast.LookingForNearObjects = false;

JNewtonWrapper.WorldRayCast(world, ref p0, ref p1, worldRayCastCallBack, null,null);

parameter = Jad.Physics.RayCast.PlacementParameter;

           Vector3 dir=p1-p0;
           
           Jad.Physics.RayCast.ContactPoint = p0 + dir * parameter;

           if (parameter < 1f) return true;

           return false;
       }


In that method the OnlyMass0 doesn´t matter as you say.  But the following method:


/// <summary>
/// Callback for Newton ray cast methods
       /// </summary>
       /// <param name="body">the Newton body <see cref="JRigidBody"/></param>
       /// <param name="normal">The normal</param>
       /// <param name="collisionID">Collision object</param>
       /// <param name="userData">User data</param>
       /// <param name="intersectParam">Intersection value</param>
       /// <returns>TODO</returns>
static float RayCastPlacement(int body, ref Vector3 normal, int collisionID, Object userData, float intersectParam)


Uses the OnlyMass0 property to see if an object must be check. Hope it helps! Greetings!

Vicente

Iron_Wardog







Stratos es un servicio gratuito, cuyos costes se cubren en parte con la publicidad.
Por favor, desactiva el bloqueador de anuncios en esta web para ayudar a que siga adelante.
Muchísimas gracias.