Posted: 3rd Jan 2022 14:12
Working on a 3D game with my kids and I'm finding 3D much harder to work with in AppGameKit than it was in DBPro. The issue here is my limited knowledge combined with what seems like rather command lacking/outdated documentation.

Is there a current/updated guide, tutorial, or document for working with 3D in AppGameKit?
Posted: 3rd Jan 2022 15:58
Not that I am aware of, and some of it is wrong and then gets echoed with the Tutorial Guide vol2. An example is compound objects, all documentation (AGK's + the paid guide) indicates that when placing an object as a component of a compound object the reference point is global 0, this is wrong and it is actually the insertion point of the object you are turning into a compound object (the component objects are invisible which all adds to frustration of 3D in AppGameKit and the poor documentation.)

The 3d component in AppGameKit is surprisingly robust once you do get it working. The built-in slider motor is surprisingly effective in giving the impression of ramp up / ramp down speeds and adding that type of realism. However the powered motors and joints are all based on one object being static, so robot arms for example need some trickery to get moving bits working with other moving bits.

When I get my software launched in few weeks I need to spend time on my website and have the intention to put together an AppGameKit 3d primer of some kind with basics for motors and such.
Posted: 3rd Jan 2022 16:12
"The 3d component in AppGameKit is surprisingly robust once you do get it working."
I've heard similar from others, which is what prompted me to see what we can create with it. I think the 3D component is both under documented and under sold.

"When I get my software launched in few weeks I need to spend time on my website..." Link!
Posted: 3rd Jan 2022 16:55
@jd_zoo A lot of examples have Directional Light commands that don't seem to work in either AGK2 or AGKS.
Would you happen to know what the updated/current command and syntax is?
Posted: 3rd Jan 2022 18:06
Directional Light

i believe that was replaced with the Sun:
+ Code Snippet
// Project: Sun 
// Created: 2022-01-03
// By: Virtual Nomad
// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "Sun" )
SetWindowSize( 1280,720, 0 )
SetWindowAllowResize( 1 )

// set display properties
SetVirtualResolution( 1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) 
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 ) 


ground = CreateObjectPlane(200,200)		:	RotateObjectLocalX(ground,90)	:	SetObjectReceiveShadow(ground,1)

for x = 1 to 75
	y = random(5,50)
	this = CreateObjectBox(10,y,10)		:	SetObjectPosition(this,random(0,180)-90,y/2.0,random(0,180)-90)
	SetObjectCastShadow(this,1)			:	SetObjectColor(this,random(128,255),random(128,255),random(128,255),255)
next x

SetCameraPosition(1,0,100,-150)		:	SetCameraLookAt(1,0,0,0,0)

SMode = 3
SetShadowMappingMode(SMode)			:	SetShadowSmoothing(0)
SetShadowMapSize( 1024, 1024 )

do
    If GetRawKeyState(27) then Exit
	
    INC Angle
	if Angle = 360
		Angle = 0
		INC SMode	:	if SMode = 4 then SMode = 0
		SetShadowMappingMode(SMode)
	EndIf
		
	x# = SIN(Angle)
	z# = COS(Angle)
	SetSunDirection(x#,-1,z#)

    Print( Angle )
    Print( SMode )
    Sync()
loop


Posted: 3rd Jan 2022 18:53
Yes there is only one light source that can create shadows and that is the sun. You can add CreatePointLight() for ambience but they won't produce a shadow.
Posted: 3rd Jan 2022 19:33
Awesome. tyvm, jd and VN!