Lingo Error: 3D cloned object...

Hi Experts, Was wondering if you could help.............

I have created a 3d scene and cloned a character in from the cast, this character is able to navigate around the screen, however im attempting to make it so when it walks into the blocks they will be solid, i added a collision code to try but get a error on the pMouse lines, yet recieve the error:

---------------------------------------------------
Script error: Object expected
pMouse.addmodifier(#collision)
---------------------------------------------------

Does anyone know how to fix this so it relates to a model cloned in?



To clone the model i used:

---------------------------------------------------
pMouse = pMember.cloneModelFromCastmember("mouse", "mouse", member("mouse"))
pMouse.transform.scale = vector(0.2,0.2,0.2)
pMouse.transform.rotation = vector(0,90,0)
pMouse.transform.position.y = -10
pMouse.transform.position.x = 80
pMouse.transform.position.z = 40
---------------------------------------------------

then to detect collision i tried the following:

---------------------------------------------------
-- add collision modifier to the "wall"
pMember.model("block").addmodifier(#collision)

-- set bounding geometry for collision detection to bounding box of model
pMember.model("block").collision.mode = #box

-- resolve collision for wall
pMember.model("block").collision.resolve = TRUE

-- i get the error on the following line

-- add collision modifier to the character
pMouse.addmodifier(#collision)

-- set bounding geometry for collision detection to bounding box of model
pMouse.collision.mode = #mesh

-- resolve collision for character
pMouse.collision.resolve = TRUE

end
---------------------------------------------------


Thank You
henrym01Asked:
Who is Participating?
 
MediaMacrosCommented:
Basically set a variable when you add the model to true.  On the next frame have it get the model and add the modifier, etc.  Then set hte variable back to false.

For collisions this can be a huge subject.  You might try some of hte tutorials here...
http://www.dmu.com/3dd/dd0.html
0
 
MediaMacrosCommented:
Try a put to see what pMouse registers as.  You may need to wait for a full exitFRam refresh and grab the model by name instead.  

Also, its better to use a dummy box for collisions.  Its far faster and more accurate.  Also, Director's built in collision is poor at best.  You might consider havok or ray casting instead.
0
 
henrym01Author Commented:
any code example please?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.