Results 1 to 3 of 3

Thread: bounds boxes

  1. #1

    Thread Starter
    Lively Member pyrosis1313's Avatar
    Join Date
    Jun 2002
    Location
    Califonia
    Posts
    83

    bounds boxes

    I don't know if I labeled this right, ... I think they are called bounds boxes... Anyhow, is there a way I can detect collision detections easily, and less costly(processor). I've heard of bounds boxes, but no one says how to set them up.

    I know how to do it to detect if something gets hit, but I want to have a wall effect. Is there a good, reliable way?

  2. #2
    Member
    Join Date
    Mar 2001
    Posts
    60

    Reply

    Basically setting up bounding boxs is very simple all you do is check the x,y of box with that of the wall or another box: here is some sample code:

    [VB]
    'the size of the bouncing area
    maxX = Form1.Picture1.Width - Form1.Picture2.Width
    maxY = Form1.Picture1.Height - Form1.Picture2.Height

    'Move the image based on it's acceleration and make it random where the X pos will be
    PosX = PosX + AccelX + Rnd(numb) 'Off set the X pos so that it moves all around
    PosY = PosY + AccelY

    'Check for collisions
    If PosX < 0 Then
    PosX = -PosX
    AccelX = -AccelX
    ElseIf PosX > maxX Then
    PosX = maxX
    AccelX = -AccelX
    End If

    If PosY < 0 Then
    PosY = -PosY
    AccelY = -AccelY
    ElseIf PosY > maxY Then
    PosY = maxY
    AccelY = -AccelY
    End If

    Form1.Picture2.Move PosX, PosY
    [/VB]

    you would need to setup some of the variables first such as accelx and accely but all these can be done by trial and error
    What is Life? One big dream or one Big nightmere.

  3. #3

    Thread Starter
    Lively Member pyrosis1313's Avatar
    Join Date
    Jun 2002
    Location
    Califonia
    Posts
    83

    I'm sorry...

    ... wasn't specific enough. Not you, me. I want to do it in a 3d world.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width