RotateSprite3D(#Sprite3D, X, Y, Angle.f, Mode)
X and Y coordinates to define a pivot point within the sprite, at which the sprite rotates around.
RotateSprite3D() - 2 more parameters
RotateSprite3D() - 2 more parameters
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
-
- Enthusiast
- Posts: 796
- Joined: Tue May 20, 2008 2:12 am
- Location: Cologne, Germany
- Contact:
Re: RotateSprite3D() - 2 more parameters
+1.J. Baker wrote:RotateSprite3D(#Sprite3D, X, Y, Angle.f, Mode)
X and Y coordinates to define a pivot point within the sprite, at which the sprite rotates around.
Should be made optional.
Regards,
JamiroKwai
JamiroKwai
Re: RotateSprite3D() - 2 more parameters
Why should a RotateSprite3D x, y?
The rotation of sprites always looks the same.
The shift comes at DisplaySprite3D.
There, the x and y:
Where dx and dy represent the displacement then.
Here a result:
The rotation of sprites always looks the same.
The shift comes at DisplaySprite3D.
There, the x and y:
Code: Select all
x+Cos(Angle)*dx-Sin(Angle)*dy
y+Sin(Angle)*dx+Cos(Angle)*dy
Here a result:
Code: Select all
InitSprite()
InitSprite3D()
OpenWindow(0, 0, 0, 800, 600, "SCREEN", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)
CreateSprite(1, 256, 256,#PB_Sprite_Texture)
StartDrawing(SpriteOutput(1))
Box(0,0,128,128,$FF0000)
Box(128,0,128,128,$00FF00)
Box(0,128,128,128,$0000FF)
Box(128,128,128,128,$00FFFF)
StopDrawing()
CreateSprite3D(1,1)
Repeat
Event = WindowEvent()
ClearScreen(0)
Angle.f+0.02
Start3D()
RotateSprite3D(1, Degree(Angle), 0)
DisplaySprite3D(1, 128, 128) ; no shift, roate at center
dx = 128 : dy = 128 ; Shift to a corner
DisplaySprite3D(1, 384+Cos(Angle)*dx-Sin(Angle)*dy, 128+Sin(Angle)*dx+Cos(Angle)*dy) ; with shift
Stop3D()
FlipBuffers()
Until Event = #PB_Event_CloseWindow
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: RotateSprite3D() - 2 more parameters
Interesting and thanks for posting. But I think I would still prefer the request. As I think it would fit the command. 

www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.