Foros - Stratos

Proyectos => Jad Engine => Mensaje iniciado por: Iron_Wardog en 06 de Julio de 2006, 09:43:49 PM

Título: WorldRayCast
Publicado por: Iron_Wardog en 06 de Julio de 2006, 09:43:49 PM
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?
Título: WorldRayCast
Publicado por: Haddd en 07 de Julio de 2006, 08:05:49 AM
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...)
Título: WorldRayCast
Publicado por: Vicente en 07 de Julio de 2006, 08:52:58 AM
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
Título: WorldRayCast
Publicado por: Vicente en 07 de Julio de 2006, 10:54:09 AM
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
Título: WorldRayCast
Publicado por: Iron_Wardog en 07 de Julio de 2006, 04:46:18 PM
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?
Título: WorldRayCast
Publicado por: Haddd en 07 de Julio de 2006, 04:54:26 PM
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
Título: WorldRayCast
Publicado por: Vicente en 07 de Julio de 2006, 04:57:15 PM
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
Título: WorldRayCast
Publicado por: Iron_Wardog en 07 de Julio de 2006, 11:46:20 PM
Thanks.