  | | | clicking and Dragging models around a terrain | clicking and Dragging models around a terrain 2003-12-17 - By Alex da Franca
Back if I understand correctly you want z to be the fixed Up vector. since you do not want to move vertically (which in my code is clumsy anyway...), you can simplify the exitframe handler to:
on exitframe me if ilk(pModel) = #model then
shift = the shiftdown camPos = pCam.worldposition
fixedAxis = 3 -- 3 = z-axis; 2 = y-axis and 1 = x-axis
vHeight = pModel.worldposition[fixedAxis]
p = pCam.spriteSpaceToWorldSpace((the mouseLoc - pLeftTop - pOffset))
v = p - camPos v.normalize()
if v[fixedAxis] <> 0 then -- if the vector is parallel to the x-y plane we can't divide by 0 f = (p[fixedAxis] - vHeight) / v[fixedAxis] pModel.worldposition = p - (v * f) end if end if
end
maybe you want to try to put it in the enterframe handler instead of exitframe, because it runs smoother then. --
||| a�ex --
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
|
|
 |