Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25

Thread: Collision Slide Effect for 3DS Objects

  1. #11

    Collision Slide Effect for 3DS Objects

    another question:

    can i use my sample to make a plane to sphere(or circle) slide collision?
    is that easier? how to?

    THX

  2. #12

    Collision Slide Effect for 3DS Objects

    Sorry but i don't have time to check code (nor i have glscene). I took i quick look on the vector unit and it seems ok at fist sight.

    The system i explained above should work with 3d also (just use 3d vector math instead of 2d).
    Plane/sphere collision should be easy too. You need a function that calculates the distance between a sphere and a plane. If the plane is perpendicular to the axis (is horizontal or vertical) than it's trivial, if it's arbitrary oriented then you need some more math.

    Once you have the distance D, you check if D is smaller than the radius of the sphere. If it is, they collide.
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  3. #13

    Collision Slide Effect for 3DS Objects

    ok iam back again

    i found the failure i have
    i used the wrong function for the compenetration d

    so a little problem/failure i have is when i collide to slide
    i used for the new Vector coordinates
    [pascal]
    a,v: TVector;
    ...
    a:=add(a,v);
    [/pascal]
    and not
    [pascal]
    a:=sub(a,v);
    [/pascal]
    when i use sub the Vector a and b will be the same and i see only one
    circle and cant move :cry:
    but when i use add i can "slide" but on slide my circle step back?
    example:
    i slide in direction right the circle step right AND back
    but the step back is the failure :cry:

    here the short code:
    [pascal]
    var
    d: Double;
    v: TVector;
    ...
    d:=distv(a,b)-0.6; //0.6 are the value of size+size

    if d<0 then // if collide
    begin
    Form1.Caption:='yeah';
    // find vector distance (it will have length=distance, no good, must be normalized)
    v:=sub(a,b);
    // normalize the vector, now direction is ok, and length is 1
    normalize(v);
    // make length equal to compenetration value
    multiply(v,d);
    // ok, now vector points from a to b, length d. We subtract from position
    // so it will be pulled away
    a:=add(a,v);

    end else Form1.Caption:='no';
    [/pascal]

    Thanks u helped me so much, i wouldnt figure it in a year :roll:

  4. #14

    Collision Slide Effect for 3DS Objects

    Umm i don't understand very well the problem. could you post an executable so that tomorrow i can try it at work? Maybe with the latest sources.
    I wont be able to compile but maybe i can find the problem the same.

    Well maybe you could check that 0.6 if it's really size+size.. It could be that it's wrong and when you scale v by d you get a value too large that makes your circle bump on the other. (shooting in the dark here )

    Bye!
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  5. #15

    Collision Slide Effect for 3DS Objects

    first a picture for help

    when a collision is the Vectors position are:



    at the red cross was the collision

    later i post the exe and source

    Bye[/img]

  6. #16

    Collision Slide Effect for 3DS Objects

    first a picture to help

    http://daikrys.da.funpic.de/Problem.gif
    or
    http://daikrys.funpic.de/Problem.gif

    this are the vectors a collide by the red cross
    i draw v for better understanding
    note: this is an original screenshot from the programm

    at tomorrow i post my exe and source

    Bye

  7. #17

    Collision Slide Effect for 3DS Objects

    i did it :mrgreen:

    i change the function add to the following:
    [pascal]
    function add(v1,v2: TVector): TVector;
    begin
    result.x:=v1.x/5 + v2.x;
    result.y:=v1.y/5 + v2.y;
    result.z:=v1.z/5 + v2.z;
    end;
    [/pascal]

    then how to do a slide collision with a moving shpere and a static plane?
    a plane have 5 vectors(include the center point), or?

  8. #18

    Collision Slide Effect for 3DS Objects

    ok i uploaded it here:
    http://daikrys.funpic.de/collide.rar

    i hope u have a look :roll:

    the slide isnt very smoothed :?
    but i dont know how to get it smoother

    Thanks, bye

  9. #19

    Collision Slide Effect for 3DS Objects

    huh? :scratch:

    no new posts?

  10. #20

    Collision Slide Effect for 3DS Objects

    sorry, i've been quite busy..
    At first sight the problem seems to be one of:
    - a rounding problem: probably you round some float value to integer, but you're working with values in the range of 0.5 so rounding will loose precision. I'm quite sure this is the problem but i couldn't find where it is in the code.
    - a scale problem: maybe you're using too big values for radius, distances, etc. Try and control them.

    Bye!
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

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