Using information from modelsUnderLoc

Hi, I have the properties that I extracted using the modelsUnderLoc command in a behavior that is used on a 3d sprite.  I need to use the #isectPosition parameter to give a position vector to a model that I place in the world on the fly.  The part of my script looks like this:

PT = the mouseLoc - point (pSprite.left, pSprite.top)

put the sprite (pSprite).camera.modelsUnderLoc (pt, [levelOfDetail: #detailed]) .isectPosition

The output of the modelsUnderLoc with detailed information in the message window looks like this:

-[[#model: model ("' 036 OTHER vertebral Basilar '"), #distance: 37.4722, #isectPosition: vector (- 2.8409, - 4.5276, - 5.8558), #isectNormal: vector (- 0.2357, - 0.2357 0.9428), #meshID: 1, #faceID: 1958, #vertices: [vector (- 2.8551, - 4.6074, - 5.8793), vector (- 2.8189, - 4.4988, - 5.8431), vector (- 2.8913, - 4.5712, - 5.8793)] #uvCoord: [#u: #v 0.6492,: 0.2563]]]

How to do as the vector of #isectPosition on all of this info?

If you attach the behavior to your 3d sprite, it should output the required information:

on mouseDown (me)
 
tempSprite = sprite (me.spriteNum)
 
PT = _mouse.mouseLoc - point (tempSprite.left, tempSprite.top)
m = tempSprite.camera.modelsUnderLoc (pt, [#levelOfDetail: #detailed])
If m.count then
-at least a model was raycast
-the position of the intersect of the first output model raycast
put the [1] m [#isectPosition]
end if
 
end mouseDown

Tags: Director

Similar Questions

Maybe you are looking for