Jump to content

How to attach to world object


Recommended Posts

  local w, h = guiGetScreenSize ()

function glue(thePlayer, cmd)
  local tx, ty, tz = getWorldFromScreenPosition ( w/2, h/2, 50 )
  local px, py, pz = getCameraMatrix()
  local hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz )
  if hit then
    attachElements(theElement, theElementToAttach, posX, posY, posZ, rotX, rotY, rotZ)
    end
  end
addCommandHandler("glue", glue)

Something like that. Didn't tested it so it may not work but with something like this you can make want you want

Link to comment

@Hydra
It's Work't 
spacer.png

 

local w, h = guiGetScreenSize ()
function glue(thePlayer, cmd)
  local tx, ty, tz = getWorldFromScreenPosition ( w/2, h/2, 50 )
  local px, py, pz = getCameraMatrix()
  local hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz )
  if hit then
    attachElements(theElement, theElementToAttach, posX, posY, posZ, rotX, rotY, rotZ)
    end
  end
addCommandHandler("glue", glue)

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...