Professional Web Applications Themes

desperate for help!!!! - Macromedia Director 3D

I have created a 3d scene and i want to clone a character into it from another cast member which will then be able to naviagte around, however no matter what i do to clone it i come up with a error can anyone help?? this is my world and what i tried to do to clone it (just one of many diff things ive tried) please help me!!! property pSprite, pMember, pscene property pfdg, pchick, pGround, pblock, pblock2, pblock3, pblock4, pblock5, pegg, pegg2,pegg3, pegg4, pegg5, pegg6, pegg7, pegg8, pegg9, pegg10 property pViewType on beginSprite me preload member "chick" -- ...

  1. #1

    Default desperate for help!!!!

    I have created a 3d scene and i want to clone a character into it from another
    cast member which will then be able to naviagte around, however no matter what
    i do to clone it i come up with a error can anyone help??

    this is my world and what i tried to do to clone it (just one of many diff
    things ive tried) please help me!!!

    property pSprite, pMember, pscene
    property pfdg, pchick, pGround, pblock, pblock2, pblock3, pblock4, pblock5,
    pegg, pegg2,pegg3, pegg4, pegg5, pegg6, pegg7, pegg8, pegg9, pegg10
    property pViewType


    on beginSprite me
    preload member "chick"

    -- choose view type
    pViewType = #normal -- still camera

    -- get easy reference variables
    pSprite = sprite(me.spriteNum)
    pMember = pSprite.member

    -- reset world
    pMember.resetWorld()

    -- make the elements of the world





    makeblock(me)
    makeblock2(me)
    makeblock3(me)
    makeblock4(me)
    makeblock5(me)
    makeGround(me)
    makeegg(me)
    makeegg2(me)
    makeegg3(me)
    makeegg4(me)
    makeegg5(me)
    makeegg6(me)
    makeegg7(me)
    makeegg8(me)
    makeegg9(me)
    makeegg10(me)
    makeBackdrop(me)


    -- import chick
    m = pscene.cloneModelFromCastmember("chick", "chick", member("chick"))
    m.transform.scale = vector(10,10,10)
    m.transform.position.y = -2

    end



    on makeBackdrop me
    -- create the backdrop texture
    backdroptexture =
    pMember.newTexture("Backdrop",#fromCastmember,memb er("Backdrop"))

    -- add teh backdrop
    pSprite.camera.addBackdrop(backdropTexture,point(0 ,0),0)
    end

    on makeblock me
    -- create the model resource
    blockResource = pMember.newModelResource("block resource",#box)
    blockResource.height=20
    blockResource.width=60
    blockResource.length=20



    -- create the model
    pblock = pMember.newModel("block",blockResource)

    -- place the model
    pblock.transform.position = vector(-70,-20,-70)

    repeat with i = 1 to 6
    blockShader = pMember.newShader("Shader3"&&i,#standard)
    blockTexture =
    pMember.newTexture("Texture3"&&i,#fromCastMember,m ember("wall"&&i))
    blockShader.texture = blockTexture
    pMember.model[1].shaderList = blockShader
    end repeat
    end


    on makeblock2 me
    -- create the model resource
    block2Resource = pMember.newModelResource("block2 resource",#box)
    block2Resource.height=20
    block2Resource.width=60
    block2Resource.length=20



    -- create the model
    pblock2 = pMember.newModel("block2",block2Resource)

    -- place the model
    pblock2.transform.position = vector(-70,-25,-20)

    repeat with i = 1 to 6
    block2Shader = pMember.newShader("Shader4"&&i,#standard)
    block2Texture =
    pMember.newTexture("Texture4"&&i,#fromCastMember,m ember("wall"&&i))
    block2Shader.texture = block2Texture
    pMember.model[2].shaderList = block2Shader
    end repeat
    end


    on makeblock3 me
    -- create the model resource
    block3Resource = pMember.newModelResource("block3 resource",#box)
    block3Resource.height=20
    block3Resource.width=60
    block3Resource.length=20



    -- create the model
    pblock3 = pMember.newModel("block3",block3Resource)

    -- place the model
    pblock3.transform.position = vector(0,0,-70)

    repeat with i = 1 to 6
    block3Shader = pMember.newShader("Shader5"&&i,#standard)
    block3Texture =
    pMember.newTexture("Texture5"&&i,#fromCastMember,m ember("wall"&&i))
    block3Shader.texture = block3Texture
    pMember.model[3].shaderList = block3Shader
    end repeat
    end



    on makeblock4 me
    -- create the model resource
    block4Resource = pMember.newModelResource("block4 resource",#box)
    block4Resource.height=20
    block4Resource.width=60
    block4Resource.length=20



    -- create the model
    pblock4 = pMember.newModel("block4",block4Resource)

    -- place the model
    pblock4.transform.position = vector(70,-20,-70)

    -- create 6 shaders, each with a texture, and assign
    repeat with i = 1 to 6
    block4Shader = pMember.newShader("Shader2"&&i,#standard)
    block4Texture =
    pMember.newTexture("Texture2"&&i,#fromCastMember,m ember("wall"&&i))
    block4Shader.texture = block4Texture
    pMember.model[4].shaderList = block4Shader
    end repeat
    end




    on makeblock5 me
    -- create the model resource
    block5Resource = pMember.newModelResource("block5 resource",#box)
    block5Resource.height=20
    block5Resource.width=60
    block5Resource.length=20



    -- create the model
    pblock5 = pMember.newModel("block5",block5Resource)

    -- place the model
    pblock5.transform.position = vector(70,-25,-20)



    -- create 6 shaders, each with a texture, and assign
    repeat with i = 1 to 6
    block5Shader = pMember.newShader("Shader"&&i,#standard)
    block5Texture =
    pMember.newTexture("Texture"&&i,#fromCastMember,me mber("wall"&&i))
    block5Shader.texture = block5Texture
    pMember.model[5].shaderList = block5Shader
    end repeat
    end




    on makeGround me


    -- create the model resource
    groundResource = pMember.newModelResource("My Plane Resource",#plane)

    -- make it big enough to be seen
    groundResource.width = 1000
    groundResource.length = 1000

    -- make the mesh out of 10 by 10 vertices
    groundResource.widthVertices = 15
    groundResource.lengthVertices = 15

    -- create the model
    pGround = pMember.newModel("My Plane",groundResource)

    -- rotate it and reposition it to see it better
    pGround.rotate(90,0,0)
    pGround.transform.position = vector(0,-50,-250)

    -- create ground texture and shader
    repeat with i = 1 to 1
    GroundShader = pMember.newShader("Shader6"&&i,#standard)
    GroundTexture =
    pMember.newTexture("Texture6"&&i,#fromCastMember,m ember("Ground"&&i))
    GroundShader.texture = GroundTexture
    pMember.model[6].shaderList = GroundShader
    end repeat
    end

    on makeegg me
    -- create the model resource
    eggResource = pMember.newModelResource("egg resource",#sphere)
    eggResource.radius = 6



    -- create the model
    pegg = pMember.newModel("egg",eggResource)

    -- place the model
    pegg.transform.position = vector(-85,-4,-70)

    repeat with i = 1 to 1
    eggShader = pMember.newShader("Shader7"&&i,#standard)
    eggTexture =
    pMember.newTexture("Texture7"&&i,#fromCastMember,m ember("egg"&&i))
    eggShader.texture = eggTexture
    pMember.model[7].shaderList = eggShader
    end repeat
    end


    end

    on makeegg2 me
    -- create the model resource
    egg2Resource = pMember.newModelResource("egg2 resource",#sphere)
    egg2Resource.radius = 6


    -- create the model
    pegg2 = pMember.newModel("egg2",egg2Resource)

    -- place the model
    pegg2.transform.position = vector(-55,-4,-70)

    repeat with i = 1 to 1
    egg2Shader = pMember.newShader("Shader8"&&i,#standard)
    egg2Texture =
    pMember.newTexture("Texture8"&&i,#fromCastMember,m ember("egg"&&i))
    egg2Shader.texture = egg2Texture
    pMember.model[8].shaderList = egg2Shader
    end repeat
    end


    end

    on makeegg3 me
    -- create the model resource
    egg3Resource = pMember.newModelResource("egg3 resource",#sphere)
    egg3Resource.radius = 6



    -- create the model
    pegg3 = pMember.newModel("egg3",egg3Resource)

    -- place the model
    pegg3.transform.position = vector(-55,-9,-20)

    repeat with i = 1 to 1
    egg3Shader = pMember.newShader("Shader9"&&i,#standard)
    egg3Texture =
    pMember.newTexture("Texture9"&&i,#fromCastMember,m ember("egg"&&i))
    egg3Shader.texture = egg3Texture
    pMember.model[9].shaderList = egg3Shader
    end repeat
    end


    end

    on makeegg4 me
    -- create the model resource
    egg4Resource = pMember.newModelResource("egg4 resource",#sphere)
    egg4Resource.radius = 6



    -- create the model
    pegg4 = pMember.newModel("egg4",egg4Resource)

    -- place the model
    pegg4.transform.position = vector(-85,-9,-20)

    repeat with i = 1 to 1
    egg4Shader = pMember.newShader("Shader10"&&i,#standard)
    egg4Texture =
    pMember.newTexture("Texture10"&&i,#fromCastMember, member("egg"&&i))
    egg4Shader.texture = egg4Texture
    pMember.model[10].shaderList = egg4Shader
    end repeat
    end


    end

    on makeegg5 me
    -- create the model resource
    egg5Resource = pMember.newModelResource("egg5 resource",#sphere)
    egg5Resource.radius = 6



    -- create the model
    pegg5 = pMember.newModel("egg5",egg5Resource)

    -- place the model
    pegg5.transform.position = vector(-17,16,-70)

    repeat with i = 1 to 1
    egg5Shader = pMember.newShader("Shader11"&&i,#standard)
    egg5Texture =
    pMember.newTexture("Texture11"&&i,#fromCastMember, member("egg"&&i))
    egg5Shader.texture = egg5Texture
    pMember.model[11].shaderList = egg5Shader
    end repeat
    end


    end

    on makeegg6 me
    -- create the model resource
    egg6Resource = pMember.newModelResource("egg6 resource",#sphere)
    egg6Resource.radius = 6



    -- create the model
    pegg6 = pMember.newModel("egg6",egg6Resource)

    -- place the model
    pegg6.transform.position = vector(17,16,-70)

    repeat with i = 1 to 1
    egg6Shader = pMember.newShader("Shader12"&&i,#standard)
    egg6Texture =
    pMember.newTexture("Texture12"&&i,#fromCastMember, member("egg"&&i))
    egg6Shader.texture = egg6Texture
    pMember.model[12].shaderList = egg6Shader
    end repeat
    end


    end

    on makeegg7 me
    -- create the model resource
    egg7Resource = pMember.newModelResource("egg7 resource",#sphere)
    egg7Resource.radius = 6



    -- create the model
    pegg7 = pMember.newModel("egg7",egg7Resource)

    -- place the model
    pegg7.transform.position = vector(55,-4,-70)

    repeat with i = 1 to 1
    egg7Shader = pMember.newShader("Shader13"&&i,#standard)
    egg7Texture =
    pMember.newTexture("Texture13"&&i,#fromCastMember, member("egg"&&i))
    egg7Shader.texture = egg7Texture
    pMember.model[13].shaderList = egg7Shader
    end repeat
    end


    end

    on makeegg8 me
    -- create the model resource
    egg8Resource = pMember.newModelResource("egg8 resource",#sphere)
    egg8Resource.radius = 6



    -- create the model
    pegg8 = pMember.newModel("egg8",egg8Resource)

    -- place the model
    pegg8.transform.position = vector(85,-4,-70)


    needhelp2005 Guest

  2. #2

    Default Re: desperate for help!!!!

    1.Where do you define your pScene property ?

    2.If that's not it, make sure you call resetworld() for the source .w3d as
    well as the world w3d before you clone.

    3.What exact error does it pop up when trying to clone?

    Cheers

    Richard


    Richard Guest

  3. #3

    Default Re: desperate for help!!!!

    pscene is defined right at the top along with everything else:

    property pSprite, pMember, pscene
    property pfdg, pchick, pGround, pblock, pblock2, pblock3, pblock4, pblock5,
    pegg, pegg2,pegg3, pegg4, pegg5, pegg6, pegg7, pegg8, pegg9, pegg10
    property pViewType

    2. how would i reset it for the w3d file?

    and thirdly the error i recieve is:

    script error object expected
    m = pscene.cloneModelFromCastmember("chick", "chick", member("chick"))





    needhelp2005 Guest

  4. #4

    Default Re: desperate for help!!!!

    Sorry, I meant where do you "initialize" your pScene property. You may be
    trying to access a null property??

    Maybe you meant to use pMember instead huh?

    Richard


    Richard Guest

  5. #5

    Default Re: desperate for help!!!!

    where i replease pscene by pMember i get a script error invalid parameter
    instead, i need some real help with this i cant do anything with it until ive
    managed to get the cloning working, would it help if i maybe emailed the dir
    file with the w3d file so you can see for yourself whats going wrong?

    thanks for taking the time to help me with this, i really appreciate it.

    needhelp2005 Guest

  6. #6

    Default Re: desperate for help!!!!

    Hi there,

    Feel free to email me the dir file if you can't get it going.

    The way you have it set up, you are trying to clone a model called "chick"
    from a cast member called "chick" and naming the newmodel "chick". Please
    check you have a 3D member called "chick" that is seperate to the 3D member
    you are using as your pMember 3Dsprite.

    Also specify a castLib for members to avoid confusion. . . At the moment you
    are trying to clone from a 3D member in the default "internal" castLibrary.
    Is this correct?

    What is the name of the w3D member that you are using as your 3D sprite?
    Maybe you are trying to copy a model from a 3D cast member into itself?

    Cheers

    Richard


    Richard Guest

  7. #7

    Default Re: desperate for help!!!!

    PS. I only have Director 8.5 so I can't open the latest .dir files.

    Richard


    Richard Guest

  8. #8

    Default Re: desperate for help!!!!

    hi there

    i finally figured out what was wrong it simply did not like my w3d model, i
    have tried another and it works great, however now im wondering within my 3d
    scene is it possible to give all of the box instances some kind of collision
    detection so in effect they act solid when the character walks into them?

    needhelp2005 Guest

  9. #9

    Default Re: desperate for help!!!!

    Hi there,

    I'm glad you have it working!

    I think the null pScene was one of the problems though?

    Collision detection is not a trivial task however.

    If the boxes do not move when walked into by the character, the code is not
    too complex and can be done with lingo yourself. This would be made easier
    if the character does not jump, but merely walks around the boxes on the
    ground plane.

    If the boxes need to move / slide / tilt / roll when hit you may need to
    look at the "Havok Xtra" which is often discussed in this group. The physics
    involved with be too complex to try with lingo alone, as all boxes have to
    collision check against the character, AND all other boxes, (any or all of
    which could be in motion in 3D space), AND the ground terrain. Do not use
    the collision modifier. It is useless.

    Unfortunately I have never had cause to use the Havok Xtra.

    It shipped with Director 8.5, but not with the latest director I think.

    Feel free to start a fresh thread about the Havok solution to your problem.

    Richard


    Richard Guest

  10. #10

    Default Re: desperate for help!!!!

    i dont need to use havok as my blocks are stationary, however i still cant
    figure out how to get the collision working for each one. can you give me any
    ideas how to achieve it?

    thanks again for the time your taking helping me

    oh and yes it was pMember!

    needhelp2005 Guest

  11. #11

    Default Re: desperate for help!!!!

    I can't give you a finished script, but here's some pseudo code for a simple
    radial push. . . NOTE this is not real code and needs checking for syntax
    and adapting to your actual property namesetc. You will need a "go to the
    frame" frame handler to loop round a single frame. Then the exitFrame below
    will be called repeatedly.


    property pBoxList,pCollisionRadius,pVelVector

    on beginSprite
    --create a list and add all your box models to it.
    --eg.
    pBoxList = [ ]
    pCollisionRadius = 200 --Set this to match the rough radius of your boxes.
    pBoxList.add(pMember.model("box1"))
    pBoxList.add(pMember.model("box2"))--and so on. . .
    --you could use a repeat loop for the above bit to avoid repetition.

    pVelVector = vector(0,0,0)
    end beginSprite

    on exitFrame
    --read in the keys and add small velocities to your pVelVector (character
    velocity on the xyz)
    --based on input.
    -- Checkout m.zAxis() and use the x and z components as velocity values to
    add each frame.

    --collisions. . .
    repeat with i = 1 to pBoxList.count
    diffVector = pBoxList[i].worldPosition - m.worldPosition+velVector
    diffVector.y = 0
    if diffVector.magnitude < pCollisionRadius then
    pushVector
    = -diffVector.getNormalized()*(pCollisionRadius-diffVector.magnitude)
    velVector = velVector+pushVector
    put "collision with box " & i
    end if
    end repeat

    --move your chick here
    m.worldPosition = m.worldPosition+pVelVector
    --apply friction drift fake. . .
    pVelVector = pVelVector * 0.95

    end exitFrame

    This should give you a start at least. Square linear push can be done in a
    similar way (doing the x and z push seperately) I'm afraid that's all I can
    supply for now. Hope that helps a little. Check out Amazon for some good
    Director 3D / Advanced Lingo books for ray casting collisions. Good luck!

    Richard


    Richard Guest

  12. #12

    Default Re: desperate for help!!!!

    PS. if your character behaves oddly when colliding I may have got this line
    the wrong way round. Brains a bit dogo at the mo and it's all from memory. .
    ..

    diffVector = (m.worldPosition+velVector)-pBoxList[i].worldPosition

    It's one or the other. . . ;)

    Richard



    Richard Guest

Similar Threads

  1. desperate man! Please take a look!
    By quiero mas in forum Coldfusion Database Access
    Replies: 5
    Last Post: July 11th, 05:06 AM
  2. Also Desperate
    By Jazzy in forum Web Design
    Replies: 4
    Last Post: May 2nd, 02:18 PM
  3. help me please i'm desperate
    By ieraks webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 8
    Last Post: December 10th, 03:20 PM
  4. I'm DESPERATE...
    By wgold webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 24th, 08:54 PM
  5. Please help, am desperate
    By Adam in forum Macromedia Director Basics
    Replies: 3
    Last Post: July 16th, 02:48 AM

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