Professional Web Applications Themes

the angle from point A to point B (where the mouse is) - Macromedia Director 3D

i'm trying to figure out the angle between a point in my sceane and the point at which the mouse has been clicked. i've been looking at 3dD world ([url]http://www.dmu.com/[/url]) but my maths skills arent strong enough to figure it out from the starting point that gives me. so i have something like: mousePlace = the mouseLoc - point(sprite(1).left, sprite(1).top) tRollOverModel = sprite(1).camera.modelUnderLoc(mousePlace) if tRollOverModel <> 0 and _mouse.mouseDown then targ = sprite(1).camera.spriteSpaceToWorldSpace(mousePlac e) put "mouseover " & targ end if this tells me if ive clicked on the model and gives me "a" reading on where the mouse is. ...

  1. #1

    Default the angle from point A to point B (where the mouse is)

    i'm trying to figure out the angle between a point in my sceane and the
    point at which the mouse has been clicked. i've been looking at 3dD
    world ([url]http://www.dmu.com/[/url]) but my maths skills arent strong enough to
    figure it out from the starting point that gives me.

    so i have something like:

    mousePlace = the mouseLoc - point(sprite(1).left, sprite(1).top)

    tRollOverModel = sprite(1).camera.modelUnderLoc(mousePlace)

    if tRollOverModel <> 0 and _mouse.mouseDown then
    targ = sprite(1).camera.spriteSpaceToWorldSpace(mousePlac e)
    put "mouseover " & targ
    end if

    this tells me if ive clicked on the model and gives me "a" reading on
    where the mouse is. i want to rotate a model to point at where the mouse
    is.

    any help would be much apreciated.

    jon
    Jon Moyles Guest

  2. #2

    Default Re: the angle from point A to point B (where the mouseis)

    Check out pointat()
    and if you need, anglebetween()
    walfridson Guest

  3. #3

    Default Re: the angle from point A to point B (where the mouseis)

    so, time for a little math :)

    A, B -> points
    v = B-A ->vector from A to B
    vx -> x axis
    alpha -> angle between v and vx

    v . vx
    --------- = cos alpha
    |v| . |vx|
    juroo Guest

  4. #4

    Default Re: the angle from point A to point B (where the mouse is)

    thanks guys

    i havent solved it yet though. i apologise for my ignorance.

    heres whats going on. i have a pendulum hanging in my sceane, i want to
    point the pendulum towards a mouse click (and then have it swing, the
    swinging part works fine). pointing it at a mouse click is proving a lot
    harder.

    i want the pendulum to only move on one plane (it rotates on its x axis).

    heres what i'm trying to do. i find the place where the user has clicked
    (targ) i find the location of the fulcrum (fulcrumLoc) and i find the
    location of the camera (cameraLoc). then i try to get the angle from the
    fulcrumLoc to the point on the sightLine (targ - cameraLoc) on the yz
    plane (where to turn the pendumlum to point at the mouse).

    mousePlace = the mouseLoc - point(sprite(1).left, sprite(1).top)
    cameraLoc = sprite(1).camera.worldPosition
    fulcrumLoc = member("pendulum04").model("fulcrum01").worldPosit ion
    targ = sprite(1).camera.spriteSpaceToWorldSpace(mousePlac e)
    sightLine = targ - cameraLoc
    pendulumAngle =
    member("pendulum04").model("fulcrum01").transform. position.angleBetween(sightLine)


    as you can see i dont know what i'm doing. for one thing i dont know how
    to work on a point in the yz plane. for another
    transform.position.angleBetween is throwing a "method not found" error.
    So i still need help. I apreciate the efforts already made and would
    really like it if somebody can explain what i'm doing wrong.

    thanks
    jon
    Jon Moyles Guest

Similar Threads

  1. Getting a camera to point at one point
    By mufc 1974 in forum Macromedia Director 3D
    Replies: 1
    Last Post: December 13th, 07:14 PM
  2. Add Point tool won't add point
    By Mike_Wickham@adobeforums.com in forum Adobe Illustrator Windows
    Replies: 4
    Last Post: June 6th, 12:17 AM
  3. The best way to rotate point around other point ?
    By Demonator webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 0
    Last Post: December 5th, 08:41 PM
  4. What's the point?
    By Michael Campbell in forum Ruby
    Replies: 7
    Last Post: July 17th, 09:56 PM

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
  •  

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