Professional Web Applications Themes

pointat error is still there??? - Macromedia Director 3D

Please can you Help? Basically pointat gives me invalid vector when my object moves at right angles to the world/itself). I have tried the below suggested solution and it works for a while then eventually I still get invalid vector. I believe I am having the same problem as: Topic Title: problems with pointAt Created On: 05/11/2004 02:43:14 AM [url]http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=268&thre[/url] adid=826232&highlight_key=y&keyword1=pointat Here is my code , it is in a timeout / actorlist. parentpl = scene.model("box").getworldtransform().position parentx = parentpl.x parenty = parentpl.y parentz = parentpl.z if parentx = 0 then -- adds an amount so that it never = 0 ...

  1. #1

    Default pointat error is still there???

    Please can you Help?

    Basically pointat gives me invalid vector when my object moves at right angles
    to the world/itself). I have tried the below suggested solution and it works
    for a while then eventually I still get invalid vector.
    I believe I am having the same problem as:
    Topic Title: problems with pointAt
    Created On: 05/11/2004 02:43:14 AM

    [url]http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=268&thre[/url]
    adid=826232&highlight_key=y&keyword1=pointat

    Here is my code , it is in a timeout / actorlist.

    parentpl = scene.model("box").getworldtransform().position
    parentx = parentpl.x
    parenty = parentpl.y
    parentz = parentpl.z

    if parentx = 0 then -- adds an amount so that it never = 0
    parentx = parentx + 1 --tried many different values inc 0.00001
    end if
    if parenty = 0 then
    parenty = parenty + 1
    end if
    if parentz = 0 then
    parentz = parentz + 1
    end if

    parentp = vector(parentx,parenty,parentz)

    up = vector(0.00001,0.99999,0.00001)
    parentq = float(parentp)
    if boxmoved <> parentpl then
    scene.model(mybox).pointat(parentq+bxdis,up) -- still goes wrong when at
    right angles
    scene.model(mybox).translate(0,0,boxespeed1, #self)
    else invalid vector

    Apart from this not working, when it should !?!?!?!?!, my solution is going to
    add loads of extra calculations just to get it to work at all. I am planning on
    having many objects using this code similtaneously so this is all very
    unnecesary.

    If this hasnt got a definate solution then is there a simple way to calcuate
    the pointat without the pointat function. I m not a mathamatician (yet :( ).

    Can you help me?
    thanks a million
    joe remainz



    remainz Guest

  2. #2

    Default Re: pointat error is still there???

    What is bxdis? PointAt generally fails when the node you are aligning, in your
    case scene.model(mybox) has the same position as the position you are
    targetting, parentq+bxdis. Meaning, you can't point something at itself. So
    if bxdis.magnitude= 0, then you will get an error. You probably don't need the
    initial bit of code with the parentx, etc., but I realize you are trying to
    trap an error condition. Also parentq = float(parentp) is not needed because
    vectors are always a list of 3 floats. If you are trying get a camera to orbit
    a point in space, using this form of rotate is easier:

    pCamera.rotate(pCameraTarget, vector(0,1,0), -dX * pCameraRotateSpeed, #world )

    pCameraTarget is the point you are rotating around
    vector(0,1,0) is the up vector (default for Shockwave3D, might be different in
    your world)
    -dX is your mouseH delta
    pCameraRotateSpeed is some number which looks right (try 0.5 for starters)

    Also, from my experience, axis alignment issues are only problem a performance
    problem with modelsUnderRay(), but it shouldn't make a difference in your
    example in any case. If you're still having problems, try posting a link to a
    sample. Good luck.




    nick kang Guest

  3. #3

    Default Re: pointat error is still there???

    thanks nick

    I managed to stop the error by setting the up vector to
    up = vector (1,1,1)

    I believe that it is an Invalid #point error and not a #vector one. I cleaned
    up the unecessary bits of script. Bxdis was another random offset and actually
    made no difference if it was at (0,0,0) or not.

    I am working with models not cameras here and its a shame that this error
    happens and isnt automatically ignored as it means that pointat is really only
    meant for cameras, as they arnt going to point at themselves, whereas models
    could quite easily end up in the same spot or axis.

    thansk again
    joe remainz


    remainz Guest

Similar Threads

  1. Contrain PointAt to z-axis of object
    By Mazuho in forum Macromedia Director 3D
    Replies: 4
    Last Post: May 29th, 01:45 PM
  2. Replies: 0
    Last Post: March 29th, 09:49 PM
  3. Replies: 0
    Last Post: November 10th, 05:24 PM
  4. problems with pointAt
    By PpHammer in forum Macromedia Director 3D
    Replies: 1
    Last Post: May 11th, 10:17 AM
  5. Replies: 1
    Last Post: August 7th, 07:13 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