Advertisement
metalx1000

Blender 3D Game - Move Object with Mouse - Drag & Drop

Feb 11th, 2012
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. import bge
  2.  
  3. cont = bge.logic.getCurrentController()
  4. owner = cont.owner
  5.  
  6. mouse = cont.sensors["movement"]
  7. width = bge.render.getWindowWidth()
  8. width = width/2
  9.  
  10. height = bge.render.getWindowHeight()
  11. height = height/2
  12.  
  13. pos = mouse.position
  14.  
  15. posX = width-pos[0]
  16. posX = posX*0.03*-1
  17. owner.localPosition.x = posX
  18.  
  19. posZ = height-pos[1]
  20. posZ = posZ*0.03
  21. owner.localPosition.z = posZ
  22. print(posX)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement