Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: help with advanced mesh collision  (Read 2921 times)
ShlomiP
Community Member
*
Posts: 20


« on: October 08, 2009, 05:40:48 AM »

hi, i try to make a little shoot game in tv3d and vb6 and i have problem with mesh collision
what i need to do is landscape with meshes that i can jump and fall from/to meshes or climb up on meshes like stairs.
anybody can give me an example or source code that can help me? Undecided
Logged
sinisa1982
Community Member
*
Posts: 188

Siniša Abramović


WWW
« Reply #1 on: October 08, 2009, 06:47:34 AM »

Set mesh physics and landscape physics.
Logged

sinisa1982
Community Member
*
Posts: 188

Siniša Abramović


WWW
« Reply #2 on: October 08, 2009, 06:48:57 AM »

Or visit http://www.woodgamesfx.com in future I will set more tutorials , examples and source code.
Logged

ShlomiP
Community Member
*
Posts: 20


« Reply #3 on: October 08, 2009, 07:26:16 AM »

how?
Logged
sinisa1982
Community Member
*
Posts: 188

Siniša Abramović


WWW
« Reply #4 on: October 08, 2009, 08:13:16 AM »

Tomorrow I will put some samples .
Logged

ShlomiP
Community Member
*
Posts: 20


« Reply #5 on: October 08, 2009, 08:46:39 AM »

thnks, i try this:
Code:
If Scene.AdvancedCollision(l_Start2, l_End, collres, TV_COLLIDE_ACTOR2, TV_TESTTYPE_ACCURATETESTING) = False Then
    FallTime = FallTime + 1
    EyePos.Y = EyePos.Y - 0.1 * FallTime
    If EyePos.Y < LandHei(EyePos.X, EyePos.z) + PlayerHei Then EyePos.Y = LandHei(EyePos.X, EyePos.z) + PlayerHei: FallTime = 0
Else
    If collres.collisionimpact.Y < EyePos.Y Then
        FallTime = FallTime + 1
        EyePos.Y = EyePos.Y - FallTime * 0.1
        If EyePos.Y < collres.collisionimpact.Y + PlayerHei Then EyePos.Y = collres.collisionimpact.Y + PlayerHei: FallTime = 0
    Else
        EyePos.Y = collres.collisionimpact.Y + PlayerHei
    End If
End If
its not working
Logged
ShlomiP
Community Member
*
Posts: 20


« Reply #6 on: October 08, 2009, 09:14:26 AM »

TV_TESTTYPE_ACCURATETESTING isn't work well. my code work if i change it to bounding sphere,why Huh Huh Huh
Logged
ShlomiP
Community Member
*
Posts: 20


« Reply #7 on: October 17, 2009, 04:53:24 PM »

anybody?
Logged
zicmaxx
Community Member
*
Posts: 51


« Reply #8 on: October 18, 2009, 08:45:56 AM »

I have true collision detect concept. but maybe it hard to implement that.

I test by my game it good working. please see this

http://www.truevision3d.com/forums/old_forums/old_topic-t13213.0.html



Logged

ShlomiP
Community Member
*
Posts: 20


« Reply #9 on: October 18, 2009, 11:52:24 AM »

thanks, but i know the method, my problem is how to implement that
i try this code:
Code:
If Scene.AdvancedCollision(l_Start2, l_End, collres, TV_COLLIDE_ACTOR2, TV_TESTTYPE_BOUNDINGBOX Or TV_TESTTYPE_ACCURATETESTING, True) = False Then
    FallTime = FallTime + 1
    EyePos.Y = EyePos.Y - 0.1 * FallTime
    If EyePos.Y < LandHei(EyePos.X, EyePos.z) + PlayerHei Then EyePos.Y = LandHei(EyePos.X, EyePos.z) + PlayerHei: FallTime = 0
Else
    If collres.collisionimpact.Y < EyePos.Y Then
        FallTime = FallTime + 1
        EyePos.Y = EyePos.Y - FallTime * 0.1
        If EyePos.Y < collres.collisionimpact.Y + PlayerHei Then EyePos.Y = collres.collisionimpact.Y + PlayerHei: FallTime = 0
    Else
        EyePos.Y = collres.collisionimpact.Y + PlayerHei
    End If
End If
the original code is sample from tv3d:
Code:
         ' GRAVITY TEST
         ' Do a vertical check from the player position + 10 to the landscape.
         Dim Coll As TV_COLLISIONRESULT
         Dim test As Boolean
         test = Scene.AdvancedCollision(Vector3(ActorPosition.x, ActorPosition.y + 10, ActorPosition.z), Vector3(ActorPosition.x, LandHeight, ActorPosition.z), Coll, TV_COLLIDE_MESH, TV_TESTTYPE_ACCURATETESTING, True)
   
         If test = False Then
           ' there is nothing else than landscape below the actor, so the actor must fall
            ActorPosition.y = ActorPosition.y - TV.AccurateTimeElapsed * 0.1
            If ActorPosition.y < LandHeight Then ActorPosition.y = LandHeight
         Else
           ' check the impact point of collision
           If Coll.collisionimpact.y < ActorPosition.y Then
             ' if impact is below actor, it must fall,
             ActorPosition.y = ActorPosition.y - TV.AccurateTimeElapsed * 0.1
             If ActorPosition.y < Coll.collisionimpact.y Then ActorPosition.y = Coll.collisionimpact.y
           Else
             'else it must go up
             ActorPosition.y = Coll.collisionimpact.y
           End If
         End If
         
      End If
(vb\tutorials\b15 - advanced collision)

why its not work Huh Huh Huh
Logged
arnienet
Customers
Community Member
*****
Posts: 253


WWW
« Reply #10 on: October 28, 2009, 04:04:45 PM »

Hi

Regarding your problem:

If you are trying to test for both a collision with a mesh and or a landscape on the Y axis, it may be better to test for a vertical / gravity based collision separately from X/Z axis, after you have performed for a X/Z collision. I did have a similar problem with TV_TESTTYPE_ACCURATETESTING, but it actually does work well if your mesh model doesn't have any holes in it and you rayStart vector starts before the collision point of Y. I say this as I think a common problem with a gravity test on a mesh has been to make the Y value of the start ray the same as the Y value of the actor, this would make the actor fall through a mesh if the Y value of the actor and the mesh at the collision point were the same.

So what I do for example is:

actorY = actorY - gravity * elapsed time
rayStart_Y = actorY + 0.2
rayEnd_Y = actorY - 0.2

If collision with mesh then actorY = collisionResult.collsionImpactY
If collision with land then actorY = land.getheight(actorX, actorZ)

If the actor collides with a Y point < 0.2 as it moves forward it would also step up onto a mesh (slopes / steps / boxes).



« Last Edit: October 28, 2009, 04:09:24 PM by arnienet » Logged

Total Dev time = 50% to code, 50% to test, 50% to find errors, 50% to fix, that's why it takes twice as long.

Dawn World MMO
ShlomiP
Community Member
*
Posts: 20


« Reply #11 on: October 31, 2009, 03:17:21 PM »

First, thanks for your answer, but i havent Actor as a player, its simulator, the camera is the player.
Logged
Pages: [1]
  Print  
 
Jump to:  

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