November 25, 2020, 08:17:58 AM

Author Topic: [bb] DeltaRoll by Stevie G [ 1+ years ago ]  (Read 588 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] DeltaRoll by Stevie G [ 1+ years ago ]
« on: June 29, 2017, 12:28:41 AM »
Title : DeltaRoll
Author : Stevie G
Posted : 1+ years ago

Description : Returns the roll angle between two entities

Code :
Code: BlitzBasic
  1. Graphics3D 640,480,16,1
  2.  
  3. Global Camera = CreateCamera() : PositionEntity Camera, 0, 0, -30
  4. Global Ship = CreateCone(): ScaleMesh Ship, 1, 2, 1 : EntityColor Ship, 0,0,255
  5. Global Target = CreateCube() : EntityColor Target,255,0,0
  6.  
  7. Repeat
  8.  
  9.         If KeyHit( 57 )
  10.                 PositionEntity target, Rand(-20,20 ), Rand(-20,20 ), 10
  11.         EndIf
  12.        
  13.         DR# = DELTAroll( Ship, Target )
  14.         TurnEntity ship, 0, 0, DR * .01
  15.        
  16.         RenderWorld()
  17.  
  18.         Text 0,0,DR
  19.        
  20.         Flip
  21.  
  22. Until KeyDown(1)
  23.  
  24. ;=================================================================================
  25. ;=================================================================================
  26. ;=================================================================================
  27.  
  28. Function DELTAroll#( Source , Target )
  29.  
  30.         TFormPoint 0,0,0 , Target, Source
  31.         Return VectorYaw ( TFormedX() , 0 , TFormedY() )
  32.  
  33. End Function


Comments :


Santiworld(Posted 1+ years ago)

 :) in 3D only need 2 or 3 angles?i make missiles, and use deltayaw & deltapitch..is the same concept, no?


Stevie G(Posted 1+ years ago)

 It is the same concept as deltayaw.  I only wrote it cos someone asked me to but it's useful if your doing a 2d in 3d game using just the x + y axis instead of x + z axis.  I use it myself for this purpose.


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal