Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Collision problem  (Read 1802 times)
Rytif
Community Member
*
Posts: 8


« on: March 07, 2006, 08:01:48 PM »

Hello, I'm having a problem on getting my collision to work in C# . All I want is a simple collision between an actor and a mesh. The Obj12 is the mesh btw. It seems that I might have to do something with the "ref linestart and ref lineend".. I've already declared them before hand without any trouble. However, am I suppose to assign sometype of a value to it? Or am I just using the wrong collision code... I just want some simple collision.

Thanks for any help.. and this is what I wrote so far..
Code:
 

          DxVBLibA.D3DVECTOR linestart;
          DxVBLibA.D3DVECTOR lineend;
       

           Obj12.SetCollisionEnable(true, -1);
                   

            Obj12.ShowBoundingBox(true);

                   

            if (Obj12.Collision(ref linestart, ref lineend, CONST_TV_TESTTYPE.TV_TESTTYPE_BOUNDINGBOX, ref distance) == true)
            {
               
            }
Logged
Rytif
Community Member
*
Posts: 8


« Reply #1 on: March 08, 2006, 02:08:14 AM »

nm problem solved.. Smiley
Logged
juanpscar
Community Member
*
Posts: 2


« Reply #2 on: May 14, 2009, 12:40:54 AM »

nm problem solved.. Smiley

Como lo resolviste ayuda.
Can you help us??
I can't get the collision work

Hi, finally I can get the collision work.

Code:
//start collision point
 linestart.x = sngPositionX;
 linestart.y = sngPositionY;
 linestart.z = sngPositionZ;
                     
// Update the vectors using the angles and positions.
sngPositionX = sngPositionX + (float)(System.Math.Cos((double)sngAngleY) * sngWalk / 5.0f * TimeElapsed) + (float)(System.Math.Cos((double)sngAngleY + 3.141596 / 2) * sngStrafe / 5.0f * TimeElapsed);

sngPositionZ = sngPositionZ + (float)(System.Math.Sin((double)sngAngleY) * sngWalk / 5.0f * TimeElapsed) + (float)(System.Math.Sin((double)sngAngleY + 3.141596 / 2) * sngStrafe / 5.0f * TimeElapsed);
                       
lineend.x = sngPositionX;
lineend.y = sngPositionY;
lineend.z = sngPositionZ;

TV_COLLISIONRESULT CollisionTest = new TV_COLLISIONRESULT();

if (TVScene.AdvancedCollision(ref linestart, ref lineend, ref CollisionTest, CONST_TV_OBJECT_TYPE.TV_COLLIDE_MESH, CONST_TV_TESTTYPE.TV_TESTTYPE_ACCURATETESTING, true))
            {
                sngPositionX = linestart.x;

            }
if (TVScene.AdvancedCollision(ref linestart, ref lineend, ref CollisionTest, CONST_TV_OBJECT_TYPE.TV_COLLIDE_MESH, CONST_TV_TESTTYPE.TV_TESTTYPE_ACCURATETESTING, true))
            {
                sngPositionZ = linestart.z;
            }


But I have some problems, look at this images attached:
How to fix this problem with the collision? the camera
The camera passes through the wall a little and see what's behind img3.JPEG
please if anyone can help me I would appreciate

« Last Edit: May 19, 2009, 06:47:34 PM by juanpscar » Logged
uncasid
Community Member
*
Posts: 109


« Reply #3 on: May 14, 2009, 09:25:58 AM »

would you mind posting the solution?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks