ModelsUnderRay - show direction?

Ask a Question related to Macromedia Director 3D, Design and Development.

  1. #1

    Default ModelsUnderRay - show direction?

    Hey all, before i spend a bit of time on this, wanted some input, and to see if
    anyone has done anything.

    I have got a few objects sending out rays for collision detection, but
    sometimes unsure where they are going and what direction etc. I want to make
    something that small cylinders will be made in the direction and for the
    distance of the ray.

    Any ideas?

    Andy

    AndrewNock Guest

  2. Similar Questions and Discussions

    1. ModelsUnderRay
      Hello, I've just learnt the ModelsUnderRay technique for collision detection from the UNSW tutorial and have checked various sites to make sure...
    2. modelsUnderRay Help please!
      if i wanted to make sure a round table did not collide with a ball using modelsUnderRay would i have to use a bounding box,(as i imagine the result...
    3. modelsUnderRay help needed
      Hello i want to cast modelsUnderRay in a flight simulator like game. The aircraft is moving always in 3d and i need to check the area around the...
    4. modelsunderray ba*d!
      I have a couple of issues here. 1: I have a character proxy model that I controll around a 3D world. Using modelsunderray I am trying to detect...
    5. ModelsUnderRay ... again, again, again.
      English: Hi! Someone it has worked with the command modelsunderray in worlds where the walls do NOT BE necessarily oriented in the axes X and AND...
  3. #2

    Default Re: ModelsUnderRay - show direction?

    Hi Andrew,

    (After typing this up in notepad, I accidentally posted it in response to your
    crane question instead of this thread!)


    To align a model to a vector (such as your ray cast vector), you can use
    something like this:

    tiltAngle = vector(0,0,1).anglebetween(theVector)
    tiltVector = theVector.perpendicularto(vector(0,0,1))
    theModel.transform.rotation = vector(0,0,0)
    theModel.transform.rotate(rayBeam.transform.positi on,tiltVector,-tiltAngle)

    To align it to a ray vector, and display it correctly, if your model was a
    'box' from director's default box primitive, you would then want to position it
    halfway between the ray cast source, and the ray intersect position (because
    the box's origin is in its centre), and scale it so that it extends the full
    distance between the two.

    Luckily this is actually a frequently asked question, and something that I do
    quite a lot myself - so I happen to have some demo movies showing it in action!

    First here's some roughly compiled information about modelsUnderRay(), mostly
    advice I've given out on various director mailing lists in the past:


    [url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/mode[/url]
    lsUnderRay.txt

    And here are a few demos of how it can be used effectively (including one with
    visible beams as you described!)


    [url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/grou[/url]
    ndCollision.htm


    [url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/grou[/url]
    ndCollisionAndAlign.htm


    [url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/grou[/url]
    ndCollisionAndAlignInterpolated.htm


    [url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/wall[/url]
    Collision_V-Ray.htm


    [url]http://www.robotduck.com/content/articles/director/collision/modelsUnderRay/wall[/url]
    Collision_V-Ray_visibleBeams.htm



    Enjoy!


    - Ben


    duckets Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139