Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / red coloring in 3d scene

Author
Message
linuxluvuback
8
Years of Service
User Offline
Joined: 17th Oct 2015
Location:
Posted: 31st Jan 2016 14:06
If you look at my screeshot, there is a red coloring on the left side of the guy where there should be white sleeve, and the red coloring goes up to his head.
If you change line marked with // tune 503 , to 55.0 (moving the rows of guys over to the right) instead of where they start in x value the red is not seen.
It looks like row 2,3,4,5 have some red coloring.

// start code:
// set window properties
SetWindowTitle( "Bone Animation" )
SetWindowSize( 1024, 768, 0 )

// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
SetScissor(0,0,0,0)
SetClearColor( 101,120,154 )
SetCameraRange(1,10,2000)

SetAmbientColor( 128,128,128 )
SetSunColor( 255,255,255 )

LoadObjectWithChildren(1,"Original_Soldier.X")
LoadImage(1,"Soldier_body_1_D.png")
setobjectimage(1,1,0)

// ok1:
//guys_max_rows = 6 // tune
//guys_max_in_row = 50 // 20 ok
// ok1 ^^^ 52fps
guys_max_rows = 20 // tune501
guys_max_in_row = 3 // tune502

guys_maxc = guys_max_rows * guys_max_in_row

dim guys[guys_maxc]
dim gx#[guys_maxc]
dim gy#[guys_maxc]
dim gz#[guys_maxc]

//good1: guyx# = 6.0
// no red is seen: guyxstart = 55.0
guyxstart = 6.0 // tune 503
guyx# = guyxstart
guyy# = 0.0
guyz# = 0.0
gcnt1 = 0
gcntid = 10

row_cnt1 = 1
for row_cnt1 = 1 to guys_max_rows
guyx# = guyxstart
row_gcnt2 = 1
while row_gcnt2 =< guys_max_in_row
guyx# = guyx# + 25.0
gx#[gcnt1] = guyx#
gy#[gcnt1] = guyy#
gz#[gcnt1] = guyz#
guys[gcnt1]= gcntid
LoadObjectWithChildren(guys[gcnt1],"Original_Soldier.X")
//LoadImage(1,"Soldier_body_1_D.png")
setobjectimage(guys[gcnt1],1,0)
SetObjectPosition(guys[gcnt1],gx#[gcnt1],gy#[gcnt1],gz#[gcnt1])
// play idle animation
PlayObjectAnimation(guys[gcnt1], "", 1000, 1282, 1, 0 )
SetObjectAnimationSpeed(guys[gcnt1], 30 )
gcntid = gcntid + 1
row_gcnt2 = row_gcnt2 + 1
endwhile
guyz# = guyz# + 25.0
next

CreatePointLight( 1, 0,50,50, 100, 255,0,0 )

// texture gun
LoadImage(2,"gun_D.png")
setobjectimage( GetObjectChildID(1,2), 2, 0 )

// hide fire spot object, a cube that was added to the model to show the gun anchor point
SetObjectVisible( GetObjectChildID(1,1), 0 )

SetCameraPosition( 1,0,75,-100 )
SetCameraLookAt( 1,0,37,0,0 )

addvirtualbutton( 1, 970,715,100 )
addvirtualbutton( 2, 970,610,100 )

addvirtualbutton( 3, 50,715,100 )

// play idle animation
PlayObjectAnimation( 1, "", 1000, 1282, 1, 0 )
SetObjectAnimationSpeed( 1, 20 )

/*
// some other animations
PlayObjectAnimation( 1, "", 1000, 1282, 1, 0 )
PlayObjectAnimation( 1, "", 3744, 3828, 1, 0 )
PlayObjectAnimation( 1, "", 685, 707, 1, 0 )
PlayObjectAnimation( 1, "", 2160, 2216, 1, 0 )
*/

// get the bone that represents the head
// turn off animation on it so we can move it ourselves
headBone = GetObjectBoneByName( 1, "Bip01_Head" )
SetObjectBoneCanAnimate( 1, headBone, 0 )

SetPrintSize(15)

do
// hold shift to move slower
speed# = 4
if ( GetRawKeyState(16) ) then speed# = 0.5

// control the camera with WASD
if ( GetRawKeyState( 87 ) ) then MoveCameraLocalZ( 1, speed# )
if ( GetRawKeyState( 83 ) ) then MoveCameraLocalZ( 1, -speed# )

if ( GetRawKeyState( 65 ) ) then MoveCameraLocalX( 1, -speed# )
if ( GetRawKeyState( 68 ) ) then MoveCameraLocalX( 1, speed# )

if ( GetRawKeyState( 81 ) ) then MoveCameraLocalY( 1, -speed# )
if ( GetRawKeyState( 69 ) ) then MoveCameraLocalY( 1, speed# )

if ( getvirtualbuttonstate(1) = 1 ) then MoveCameraLocalZ( 1, -speed# )
if ( getvirtualbuttonstate(2) = 1 ) then MoveCameraLocalZ( 1, speed# )

// play death animation, transition over 0.3 seconds
if ( GetRawKeyPressed( 32 ) or getvirtualbuttonpressed(3) )
SetObjectBoneCanAnimate( 1, headBone, 1 )
PlayObjectAnimation( 1, "", 4971, 5021, 0, 0.3 )
endif

// if the death animation has stopped go back to original animation, transition over 0.5 seconds
if ( GetObjectIsAnimating(1) = 0 )
SetObjectBoneCanAnimate( 1, headBone, 0 )
PlayObjectAnimation( 1, "", 1000, 1282, 1, 0.5 )
endif

// rotate the camera
if ( GetPointerPressed() )
startx# = GetPointerX()
starty# = GetPointerY()
angx# = GetCameraAngleX(1)
angy# = GetCameraAngleY(1)
pressed = 1
endif

if ( GetPointerState() = 1 )
fDiffX# = (GetPointerX() - startx#)/4.0
fDiffY# = (GetPointerY() - starty#)/4.0

newX# = angx# + fDiffY#
if ( newX# > 89 ) then newX# = 89
if ( newX# < -89 ) then newX# = -89
SetCameraRotation( 1, newX#, angy# + fDiffX#, 0 )
endif

// rotate the head to always look at the camera
// head is backwards on the bone so rotate the vector by 180 degrees
bonex# = 2*GetObjectBoneWorldX( 1, headBone ) - GetCameraX(1)
boney# = 2*GetObjectBoneWorldY( 1, headBone ) - GetCameraY(1)
bonez# = 2*GetObjectBoneWorldZ( 1, headBone ) - GetCameraZ(1)
setObjectBoneLookAt( 1, headBone, bonex#, boney#, bonez#, 0 )

Print( "FPS: " + str(ScreenFPS()) )
Sync()
loop
// end code^^^ .

Attachments

Login to view attachments
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 31st Jan 2016 14:28
You created a red pointlight...

CreatePointLight( 1, 0,50,50, 100, 255,0,0 )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 31st Jan 2016 18:18

I think we are seeing too many forum posts with "BUG" in the title. Please can we agree to only post bug reports when we know there is actually a bug? If you just need help with something you are stuck with, just post a question. Thanks.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 31st Jan 2016 19:05
I've renamed the thread now that the rogue light has been found.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 1st Feb 2016 10:41
There will always be new/new-ish users making these posts. There are very few bugs remaining in AGK. Unless you are using new stuff or have untested hardware/OS.
linuxluvuback
8
Years of Service
User Offline
Joined: 17th Oct 2015
Location:
Posted: 2nd Feb 2016 03:55
Sorry, thought there was something wrong, but passed over the color light code.

Login to post a reply

Server time is: 2024-03-29 15:55:48
Your offset time is: 2024-03-29 15:55:48