Ooops
November 24, 2020, 06:39:37 AM

Author Topic: [bb] Movement Pegs by Picklesworth [ 1+ years ago ]  (Read 707 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Movement Pegs by Picklesworth [ 1+ years ago ]
« on: June 29, 2017, 12:28:38 AM »
Title : Movement Pegs
Author : Picklesworth
Posted : 1+ years ago

Description : It's a bit of a simple system, but it hasn't been posted in the code archives before so I may as well save somebody some time.
It may be made in 2d, but it is built for 3d stuff. You can make it for 2d stuff rather easily, by removing all referances to the Z axis in the function MovePegs_Update().
It does not currently adjust the appearance of the lines based on what camera perspective is being used, but that shouldn't be too hard to do.
If you have any questions, feel free to email me.


Code :
Code: BlitzBasic
  1. ;;;;;;;;;;;;;Example code;;;;;;;;;;;;;
  2. ;Movement Pegs v 0.4, example program
  3. ;2004, Dylan McCall
  4. ;(Mr. Picklesworth)
  5.  
  6. Graphics3D 1024,768,False,2
  7. SetBuffer BackBuffer()
  8.  
  9. AmbientLight 200,200,200
  10. light = CreateLight()
  11. PositionEntity light,-10,5,-10
  12.  
  13. cam = CreateCamera()
  14. PositionEntity cam,0,0,-10
  15.  
  16. cube = CreateCube()
  17.  
  18. MovePegs=MovePegs_Create(700,500,5,1,8,80)
  19.  
  20. While Not KeyDown(1)           
  21.         TranslateEntity cube,MovePegs_GetOutputX(MovePegs),MovePegs_GetOutputY(MovePegs),MovePegs_GetOutputZ(MovePegs) 
  22.         TurnEntity cube,MovePegs_GetOutputPitch(MovePegs),MovePegs_GetOutputYaw(MovePegs),MovePegs_GetOutputRoll(MovePegs)
  23.        
  24.         RenderWorld
  25.         MovePegs_Update()
  26.         Flip
  27.         Cls
  28. Wend
  29. End
  30.  
  31. ;;;;;;;;;;;;;System code;;;;;;;;;;;;;
  32. ;Movement Pegs v 0.4
  33. ;2004, Dylan McCall
  34. ;(Mr. Picklesworth)
  35.  
  36. Type MovePegs
  37.         Field BaseX,BaseY      
  38.         Field BaseDrag
  39.         Field PegXDrag,PegYDrag,PegZDrag
  40.         Field RotXDrag,RotYDrag,RotZDrag
  41.         Field LastX,LastY      
  42.         Field XSpeed#,YSpeed#,ZSpeed#
  43.         Field PitchSpeed#,YawSpeed#,RollSpeed#
  44.         Field MoveScale#
  45.         Field RotScale#
  46.         Field Size#
  47.         Field BaseSize
  48.         Field CircleSize
  49. End Type
  50.  
  51. Function RectOverLine(x1#,y1#,x2#,y2#,rx#,ry#,rw#,rh#) 
  52.         For h = -rh/2 To rh
  53.         For w = -rw/2 To rw
  54.                 If PointOverLine(x1#,y1#,x2#,y2#,rx#+w,ry#+h) = True Then Return True
  55.         Next
  56.         Next
  57. End Function
  58.  
  59. Function PointOverLine(x1#,y1#,x2#,y2#,px#,py#)
  60.         ;m1# = (y2-y1)/(x2-x1)
  61.         m1# = (y2-y1)/(x2-x1)
  62.         m2# = (py-y1)/(px-x1)
  63.         If m1=m2 And Distance(x1,y1,px,py) <= Distance(x1,y1,x2,y2)
  64.                 If px => x1 And py <= y1 Return True
  65.         EndIf
  66. End Function
  67.  
  68. ;Quick note regarding moveScale and RotationScale - I was asleep when I programmed the
  69. ;movement scale, and so it is the reverse of what scale would normally mean. Rather
  70. ;than multiply by movescale or rotscale, it divides. Consider this a good thing,
  71. ;because the numbers can get rather high so it would be confusing with decimals.
  72. Function MovePegs_Create(x,y,moveScale#=1,rotationScale#=0.5,BaseSize=8,size#=80)
  73.         m.movepegs = New movepegs
  74.         mMoveScale = moveScale
  75.         mRotScale = rotationScale
  76.         maseX = x
  77.         maseY = y
  78.         mBaseSize=BaseSize
  79.        
  80.         msize=size
  81.         mCircleSize#=msize / 8
  82.        
  83.         Return Handle(m)
  84. End Function
  85.  
  86. Function MovePegs_Position(entity,x,y,Glob=True)
  87.         m.movepegs=Object.movepegs(entity)
  88.         If Glob
  89.                 maseX = x
  90.                 maseY = y             
  91.         Else
  92.                 maseX = maseX + x
  93.                 maseY = maseY + y
  94.         EndIf
  95. End Function
  96.  
  97. Function MovePegs_SetBaseSize(entity,size#)
  98.         m.movepegs=Object.movepegs(entity)
  99.         mBaseSize=Size
  100. End Function
  101.  
  102. Function MovePegs_SetSize(entity,size#)
  103.         m.movepegs=Object.movepegs(entity)
  104.         msize# = size
  105.         mCircleSize#=msize / 8
  106. End Function
  107.  
  108. Function MovePegs_SetMoveScale(entity,scale#)
  109.         m.movepegs=Object.movepegs(entity)
  110.         mMoveScale# = scale
  111. End Function
  112.  
  113. Function MovePegs_SetRotationScale(entity,scale#)
  114.         m.movepegs=Object.movepegs(entity)
  115.         mRotScale# = scale
  116. End Function
  117.  
  118. Function MovePegs_Update()
  119.         For m.movepegs = Each movepegs
  120.                
  121.                 CircleXX=mBaseX+(msize/1.6)
  122.                 CircleXY=mBaseY-((mCircleSize*1.4)/2)
  123.                 CircleYX=mBaseX-((mCircleSize*1.4)/2)
  124.                 CircleYY=mBaseY-(msize/8)-(msize/1.6)
  125.                 CircleZX=mBaseX+(msize/2.8)
  126.                 CircleZY=mBaseY-(msize/2)      
  127.                
  128.                 If mpegXdrag Then Color 255,255,0 Else Color 255,0,0 ;X line
  129.                 Line mBaseX,mBaseY,mBaseX+msize,mBaseY
  130.                
  131.                 If m
  132. otXDrag Then Color 255,255,0 Else Color 255,0,0 ;X circle
  133.                 Oval CircleXX,CircleXY,mCircleSize,mCircleSize*1.4                     
  134.                        
  135.                 If mpegYdrag Then Color 255,255,0 Else Color 0,255,0 ;Y line
  136.                 Line mBaseX,mBaseY,mBaseX,mBaseY-msize
  137.                
  138.                 If m
  139. otYDrag Then Color 255,255,0 Else Color 0,255,0 ;Y circle
  140.                 Oval CircleYX,CircleYY,mCircleSize*1.4,mCircleSize
  141.  
  142.                 If mpegZdrag Then Color 255,255,0 Else Color 0,0,255 ;Z line
  143.                 Line mBaseX,mBaseY,mBaseX+(msize/1.6),mBaseY-(msize/1.6)       
  144.                                
  145.                 If m
  146. otZDrag Then Color 255,255,0 Else Color 0,0,255 ;Z circle
  147.                 Oval CircleZX,CircleZY,mCircleSize*1.4,mCircleSize
  148.                
  149.                 Color 100,100,100 ;Base
  150.                 Rect mBaseX-(mBaseSize/2),mBaseY-(mBaseSize/2),mBaseSize,mBaseSize             
  151.                
  152.                 ;Color 255,255,255             
  153.                 ;Line maseX+4,maseY-4,mBaseX+50,mBaseY-50
  154.                
  155.                 ;mpegXdrag=0 And mpegYdrag=0 And mpegZdrag=0
  156.                                
  157.                 If MouseHit(1)
  158.                         If RectsOverlap(MouseX(),MouseY(),1,1,mBaseX-(mBaseSize/2),mBaseY-(mBaseSize/2),mBaseSize,mBaseSize)
  159.                                 mBaseDrag = True
  160.                                 Goto skipclick ;Clicking on base
  161.                         EndIf
  162.                        
  163.                         If RectsOverlap(MouseX(),MouseY(),1,1,CircleXX,CircleXY,mCircleSize,mCircleSize*1.4)
  164.                                 mRotXDrag = True
  165.                                 Goto skipclick ;Clicking on X axis Rotate (Pitch)                      
  166.                         EndIf
  167.                         If RectsOverlap(MouseX(),MouseY(),1,1,CircleYX,CircleYY,mCircleSize*1.4,mCircleSize)
  168.                                 mRotYDrag = True
  169.                                 Goto skipclick ;Clicking on Y axis Rotate (Yaw)
  170.                         EndIf
  171.                         If RectsOverlap(MouseX(),MouseY(),1,1,CircleZX,CircleZY,mCircleSize*1.4,mCircleSize)
  172.                                 mRotZDrag = True
  173.                                 Goto skipclick ;Clicking on Z axis Rotate (Roll)
  174.                         EndIf
  175.                        
  176.                         If RectOverLine(maseX,maseY,mBaseX+(msize/1.6),mBaseY-(msize/1.6),MouseX(),MouseY(),8,8)
  177.                                 mPegZDrag = True
  178.                                 mLastx=MouseX() : mLastY=MouseY()
  179.                                 Goto skipclick ;Z Axis Click
  180.                         EndIf
  181.                         If RectOverLine(mBaseX,mBaseY,mBaseX+msize,mBaseY,MouseX(),MouseY(),8,8)
  182.                                 mPegXDrag = True
  183.                                 mLastx=MouseX() : mLastY=MouseY()
  184.                                 Goto skipclick ;X Axis Click
  185.                         EndIf
  186.                         If RectOverLine(mBaseX,mBaseY,mBaseX,mBaseY-msize,MouseX(),MouseY(),8,8)
  187.                                 mPegYDrag = True
  188.                                 mLastx=MouseX() : mLastY=MouseY()
  189.                                 Goto skipclick ;Y Axis Click
  190.                         EndIf
  191.  
  192.                         ElseIf Not MouseDown(1)
  193.                                 mBaseDrag = False
  194.                                 mPegXDrag = False : mPegYDrag = False : mPegZDrag = False
  195.                                 mRotXDrag = False : mRotYDrag = False : mRotZDrag = False
  196.                                 mXSpeed# = 0 : mYSpeed# = 0 : mSpeed# = 0     
  197.                                 mPitchSpeed# = 0 : mYawSpeed# = 0 : mRollSpeed# = 0
  198.                                 mLastX = mousex() : mLastY = mousey()
  199.                 EndIf
  200.                 .skipclick
  201.                 If mBaseDrag
  202.                         maseX = MouseX()
  203.                         maseY = MouseY()                      
  204.                 EndIf
  205.  
  206.                 If mpegXDrag
  207.                         ;mXSpeed = Distance(mLastX,mLastY,MouseX(),MouseY())
  208.                         ;If MouseX() < mLastX Or MouseY() < mLastY Then mXSpeed= -mXSpeed
  209.                         mXSpeed = MouseX() - mLastX
  210.                         mLastX = MouseX()
  211.                         mLastY = MouseY()                              
  212.                 EndIf
  213.                 If mpegYDrag
  214.                         ;mYSpeed = Distance(mLastX,mLastY,MouseX(),MouseY())
  215.                         ;If MouseX() < mLastX Or MouseY() < mLastY Then mYSpeed= -mYSpeed
  216.                         mYSpeed = mLastY - MouseY()
  217.                         mLastX = MouseX()
  218.                         mLastY = MouseY()                      
  219.                 EndIf
  220.                 If mpegZDrag
  221.                         ;ZSpeedA = MouseY() - mLastY
  222.                         ;ZSpeedB = MouseX() - mLastX
  223.                         mSpeed = mLastY - MouseY()
  224.                         mLastX = MouseX()
  225.                         mLastY = MouseY()                              
  226.                 EndIf
  227.                
  228.                 If mRotXDrag
  229.                         mPitchSpeed = Distance2(mLastX,mLastY,MouseX(),MouseY())
  230.                        
  231.                         ;Checks if we should go backwards, or forwards, in the rotation.
  232.                         mLastX = MouseX()
  233.                         mLastY = MouseY()                              
  234.                 EndIf
  235.                 If mRotYDrag
  236.                         mYawSpeed = Distance2(mLastX,mLastY,MouseX(),MouseY())
  237.                         mLastX = MouseX()
  238.                         mLastY = MouseY()                              
  239.                 EndIf
  240.                 If mRotZDrag
  241.                         mRollSpeed = Distance2(mLastX,mLastY,MouseX(),MouseY())
  242.                         mLastX = MouseX()
  243.                         mLastY = MouseY()                      
  244.                 EndIf
  245.  
  246.         Next
  247. End Function
  248.  
  249. function MovePegs_IsActive(entity) ;This is grammatically correct. Honest!
  250.         ;Note: Does not return anything is it is just being moved by the base
  251.         m.movepegs = Object.movepegs(entity)
  252.         if mPegXDrag or mPegYDrag or mPegZDrag or mRotXDrag or mRotYDrag or mRotZDrag then return 1
  253. end function
  254.  
  255. Function MovePegs_GetOutputX#(entity)
  256.         m.movepegs = Object.movepegs(entity)
  257.         Return mXSpeed# / mMoveScale
  258. End Function
  259. Function MovePegs_GetOutputY#(entity)
  260.         m.movepegs = Object.movepegs(entity)
  261.         Return mYSpeed# / mMoveScale
  262. End Function
  263. Function MovePegs_GetOutputZ#(entity)
  264.         m.movepegs = Object.movepegs(entity)
  265.         Return mSpeed# / mMoveScale
  266. End Function
  267.  
  268.  
  269. Function MovePegs_GetOutputPitch#(entity)
  270.         m.movepegs = Object.movepegs(entity)
  271.         Return mPitchSpeed# / mRotScale
  272. End Function
  273. Function MovePegs_GetOutputYaw#(entity)
  274.         m.movepegs = Object.movepegs(entity)
  275.         Return mYawSpeed# / mRotScale
  276. End Function
  277. Function MovePegs_GetOutputRoll#(entity)
  278.         m.movepegs = Object.movepegs(entity)
  279.         Return mRollSpeed# / mRotScale
  280. End Function
  281.  
  282. Function EntityProject(camera,entity)
  283.         CameraProject camera,EntityX(entity,1),EntityY(entity,1),EntityZ(entity,1)
  284. End Function
  285.  
  286. Function GetGreatest(a#,b#)
  287.         If a#>b# Then Return a# Else Return b#
  288. End Function
  289.  
  290. Function Distance#(x1#,y1#,x2#,y2#)
  291.         ;Uses Pythagorus theorum
  292.         Return Sqr(((x2-x1)^2)+((y2-y1)^2))
  293. End Function
  294.  
  295. Function Distance2#(x1#,y1#,x2#,y2#)
  296.         ;Returns negative or positive numbers
  297.         X# = x1-x2
  298.         Y# = y1-y2
  299.         Return X+Y
  300. End Function


Comments :


Techlord(Posted 1+ years ago)

 Corrected the Distance function with Distance2
Code: [Select]
; ID: 1238
; Author: Mr. Picklesworth
; Date: 2004-12-15 18:26:37
; Title: Movement Pegs
; Description: These are commonly used in 3d modelling tools to move objects about

;;;;;;;;;;;;;Example code;;;;;;;;;;;;;
;Movement Pegs v 0.4, example program
;2004, Dylan McCall
;(Mr. Picklesworth)

Graphics3D 1024,768,False,2
SetBuffer BackBuffer()

AmbientLight 200,200,200
light = CreateLight()
PositionEntity light,-10,5,-10

cam = CreateCamera()
PositionEntity cam,0,0,-10

cube = CreateCube()

MovePegs=MovePegs_Create(700,500,5,1,8,80)

While Not KeyDown(1)
TranslateEntity cube,MovePegs_GetOutputX(MovePegs),MovePegs_GetOutputY(MovePegs),MovePegs_GetOutputZ(MovePegs)
TurnEntity cube,MovePegs_GetOutputPitch(MovePegs),MovePegs_GetOutputYaw(MovePegs),MovePegs_GetOutputRoll(MovePegs)

RenderWorld
MovePegs_Update()
Flip
Cls
Wend
End

;;;;;;;;;;;;;System code;;;;;;;;;;;;;
;Movement Pegs v 0.4
;2004, Dylan McCall
;(Mr. Picklesworth)

Type MovePegs
Field BaseX,BaseY
Field BaseDrag
Field PegXDrag,PegYDrag,PegZDrag
Field RotXDrag,RotYDrag,RotZDrag
Field LastX,LastY
Field XSpeed#,YSpeed#,ZSpeed#
Field PitchSpeed#,YawSpeed#,RollSpeed#
Field MoveScale#
Field RotScale#
Field Size#
Field BaseSize
Field CircleSize
End Type

Function RectOverLine(x1#,y1#,x2#,y2#,rx#,ry#,rw#,rh#)
For h = -rh/2 To rh
For w = -rw/2 To rw
If PointOverLine(x1#,y1#,x2#,y2#,rx#+w,ry#+h) = True Then Return True
Next
Next
End Function

Function PointOverLine(x1#,y1#,x2#,y2#,px#,py#)
m1# = (y2-y1)/(x2-x1)
m2# = (py-y1)/(px-x1)
If m1=m2 And Distance2(x1,y1,px,py) <= Distance2(x1,y1,x2,y2) Then Return True Else Return False
End Function

;Quick note regarding moveScale and RotationScale - I was asleep when I programmed the
;movement scale, and so it is the reverse of what scale would normally mean. Rather
;than multiply by movescale or rotscale, it divides. Consider this a good thing,
;because the numbers can get rather high so it would be confusing with decimals.
Function MovePegs_Create(x,y,moveScale#=1,rotationScale#=0.5,BaseSize=8,size#=80)
m.movepegs = New movepegs
mMoveScale = moveScale
mRotScale = rotationScale
maseX = x
maseY = y
mBaseSize=BaseSize

msize=size
mCircleSize#=msize / 8

Return Handle(m)
End Function

Function MovePegs_Position(entity,x,y,Glob=True)
m.movepegs=Object.movepegs(entity)
If Glob
maseX = x
maseY = y
Else
maseX = maseX + x
maseY = maseY + y
EndIf
End Function

Function MovePegs_SetBaseSize(entity,size#)
m.movepegs=Object.movepegs(entity)
mBaseSize=Size
End Function

Function MovePegs_SetSize(entity,size#)
m.movepegs=Object.movepegs(entity)
msize# = size
mCircleSize#=msize / 8
End Function

Function MovePegs_SetMoveScale(entity,scale#)
m.movepegs=Object.movepegs(entity)
mMoveScale# = scale
End Function

Function MovePegs_SetRotationScale(entity,scale#)
m.movepegs=Object.movepegs(entity)
mRotScale# = scale
End Function

Function MovePegs_Update()
For m.movepegs = Each movepegs

CircleXX=mBaseX+(msize/1.6)
CircleXY=mBaseY-((mCircleSize*1.4)/2)
CircleYX=mBaseX-((mCircleSize*1.4)/2)
CircleYY=mBaseY-(msize/8)-(msize/1.6)
CircleZX=mBaseX+(msize/2.8)
CircleZY=mBaseY-(msize/2)

If mpegXdrag Then Color 255,255,0 Else Color 255,0,0 ;X line
Line mBaseX,mBaseY,mBaseX+msize,mBaseY

If motXDrag Then Color 255,255,0 Else Color 255,0,0 ;X circle
Oval CircleXX,CircleXY,mCircleSize,mCircleSize*1.4

If mpegYdrag Then Color 255,255,0 Else Color 0,255,0 ;Y line
Line mBaseX,mBaseY,mBaseX,mBaseY-msize

If motYDrag Then Color 255,255,0 Else Color 0,255,0 ;Y circle
Oval CircleYX,CircleYY,mCircleSize*1.4,mCircleSize

If mpegZdrag Then Color 255,255,0 Else Color 0,0,255 ;Z line
Line mBaseX,mBaseY,mBaseX+(msize/1.6),mBaseY-(msize/1.6)

If motZDrag Then Color 255,255,0 Else Color 0,0,255 ;Z circle
Oval CircleZX,CircleZY,mCircleSize*1.4,mCircleSize

Color 100,100,100 ;Base
Rect mBaseX-(mBaseSize/2),mBaseY-(mBaseSize/2),mBaseSize,mBaseSize

;Color 255,255,255
;Line maseX+4,maseY-4,mBaseX+50,mBaseY-50

;mpegXdrag=0 And mpegYdrag=0 And mpegZdrag=0

If MouseHit(1)
If RectsOverlap(MouseX(),MouseY(),1,1,mBaseX-(mBaseSize/2),mBaseY-(mBaseSize/2),mBaseSize,mBaseSize)
mBaseDrag = True
Goto skipclick ;Clicking on base
EndIf

If RectsOverlap(MouseX(),MouseY(),1,1,CircleXX,CircleXY,mCircleSize,mCircleSize*1.4)
mRotXDrag = True
Goto skipclick ;Clicking on X axis Rotate (Pitch)
EndIf
If RectsOverlap(MouseX(),MouseY(),1,1,CircleYX,CircleYY,mCircleSize*1.4,mCircleSize)
mRotYDrag = True
Goto skipclick ;Clicking on Y axis Rotate (Yaw)
EndIf
If RectsOverlap(MouseX(),MouseY(),1,1,CircleZX,CircleZY,mCircleSize*1.4,mCircleSize)
mRotZDrag = True
Goto skipclick ;Clicking on Z axis Rotate (Roll)
EndIf

If RectOverLine(maseX,maseY,mBaseX+(msize/1.6),mBaseY-(msize/1.6),MouseX(),MouseY(),8,8)
mPegZDrag = True
mLastx=MouseX() : mLastY=MouseY()
Goto skipclick ;Z Axis Click
EndIf
If RectOverLine(mBaseX,mBaseY,mBaseX+msize,mBaseY,MouseX(),MouseY(),8,8)
mPegXDrag = True
mLastx=MouseX() : mLastY=MouseY()
Goto skipclick ;X Axis Click
EndIf
If RectOverLine(mBaseX,mBaseY,mBaseX,mBaseY-msize,MouseX(),MouseY(),8,8)
mPegYDrag = True
mLastx=MouseX() : mLastY=MouseY()
Goto skipclick ;Y Axis Click
EndIf

ElseIf Not MouseDown(1)
mBaseDrag = False
mPegXDrag = False : mPegYDrag = False : mPegZDrag = False
mRotXDrag = False : mRotYDrag = False : mRotZDrag = False
mXSpeed# = 0 : mYSpeed# = 0 : mSpeed# = 0
mPitchSpeed# = 0 : mYawSpeed# = 0 : mRollSpeed# = 0
mLastX = mousex() : mLastY = mousey()
EndIf
.skipclick
If mBaseDrag
maseX = MouseX()
maseY = MouseY()
EndIf

If mpegXDrag
;mXSpeed = Distance2(mLastX,mLastY,MouseX(),MouseY())
;If MouseX() < mLastX Or MouseY() < mLastY Then mXSpeed= -mXSpeed
mXSpeed = MouseX() - mLastX
mLastX = MouseX()
mLastY = MouseY()
EndIf
If mpegYDrag
;mYSpeed = Distance2(mLastX,mLastY,MouseX(),MouseY())
;If MouseX() < mLastX Or MouseY() < mLastY Then mYSpeed= -mYSpeed
mYSpeed = mLastY - MouseY()
mLastX = MouseX()
mLastY = MouseY()
EndIf
If mpegZDrag
;ZSpeedA = MouseY() - mLastY
;ZSpeedB = MouseX() - mLastX
mSpeed = mLastY - MouseY()
mLastX = MouseX()
mLastY = MouseY()
EndIf

If mRotXDrag
mPitchSpeed = Distance2(mLastX,mLastY,MouseX(),MouseY())

;Checks if we should go backwards, or forwards, in the rotation.
mLastX = MouseX()
mLastY = MouseY()
EndIf
If mRotYDrag
mYawSpeed = Distance2(mLastX,mLastY,MouseX(),MouseY())
mLastX = MouseX()
mLastY = MouseY()
EndIf
If mRotZDrag
mRollSpeed = Distance2(mLastX,mLastY,MouseX(),MouseY())
mLastX = MouseX()
mLastY = MouseY()
EndIf

Next
End Function

function MovePegs_IsActive(entity) ;This is grammatically correct. Honest!
;Note: Does not return anything is it is just being moved by the base
m.movepegs = Object.movepegs(entity)
if mPegXDrag or mPegYDrag or mPegZDrag or mRotXDrag or mRotYDrag or mRotZDrag then return 1
end function

Function MovePegs_GetOutputX#(entity)
m.movepegs = Object.movepegs(entity)
Return mXSpeed# / mMoveScale
End Function
Function MovePegs_GetOutputY#(entity)
m.movepegs = Object.movepegs(entity)
Return mYSpeed# / mMoveScale
End Function
Function MovePegs_GetOutputZ#(entity)
m.movepegs = Object.movepegs(entity)
Return mSpeed# / mMoveScale
End Function


Function MovePegs_GetOutputPitch#(entity)
m.movepegs = Object.movepegs(entity)
Return mPitchSpeed# / mRotScale
End Function
Function MovePegs_GetOutputYaw#(entity)
m.movepegs = Object.movepegs(entity)
Return mYawSpeed# / mRotScale
End Function
Function MovePegs_GetOutputRoll#(entity)
m.movepegs = Object.movepegs(entity)
Return mRollSpeed# / mRotScale
End Function

Function EntityProject(camera,entity)
CameraProject camera,EntityX(entity,1),EntityY(entity,1),EntityZ(entity,1)
End Function

Function GetGreatest(a#,b#)
If a#>b# Then Return a# Else Return b#
End Function

Function Distance2#(x1#,y1#,x2#,y2#)
;Returns negative or positive numbers
X# = x1-x2
Y# = y1-y2
Return X+Y
End Function



Picklesworth(Posted 1+ years ago)

 Ah, right.Actually, Distance2 was only for the rotation stuff, which is why the x axis move is probably not working for you now :DI thought I included a non-userlib version of Distance (I got Distance in some magic dll which I can't locate), but I must have removed it by accident.It's been fixed now, and should be happy.Repaired version is at the top.


Picklesworth(Posted 1+ years ago)

 Fixed a small bug with the PointOverLine function. I probably cut a corner, but it works for me :)


WildCat(Posted 1+ years ago)

 Oh, you're doing useful instrument, man! Then you can program the Shift key (as it's done in Wings modeller) to turn object with 15 deg. steps. [/i]

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal