About Monkey 2 › Forums › Monkey 2 Programming Help › How do I stop the remnants in 3D
This topic contains 2 replies, has 2 voices, and was last updated by
En929 2 months, 3 weeks ago.
-
AuthorPosts
-
January 24, 2019 at 2:18 am #15997
When I play my game, when the player turns, I get this black remnants on screen. Back in BlitzBasic, there used to be a “CLS” function that stopped this. But, I wondering what do I add to my code to stop the black remnants now? A picture below has an arrow pointing to what I am trying to stop. The code is also below! Thanks!
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116Namespace myapp#Import "<std>"#Import "<mojo>"#Import "<mojo3d>"#Import "<mojo3d-loaders>"#Import "ManB3DAnim.b3d"#Import "Man_color.jpg"#Import "Tower.png"#Import "Place.b3d"#Import "OfficeBuilding.b3d"Using std..Using mojo..Using mojo3d..Class MyWindow Extends WindowGlobal _camera:CameraField _scene:SceneField _light:LightField _ground:ModelField Man:ModelField Office: ModelField Jack_in_the_Box: ModelField _animator:AnimatorField speed: Float = 1.0Field turn: Float = 1.0Method New( title:String="The World Doesn't Apply to Him",width:Int=800,height:Int=600,flags:WindowFlags=WindowFlags.Resizable )Super.New( title,width,height,flags )_scene=New SceneMan=Model.LoadBoned( "asset::ManB3DAnim.b3d")Man.Position = New Vec3f(0, 2.5,10)Man.Scale=New Vec3f( .1)_camera=New Camera( Man)_camera.View = Self_camera.Near= 1_camera.Far=100000_camera.Position = New Vec3f(0, 35, -20)_camera.PointAt( Man )'_light=New Light_light.Rotate( 45,150,0 )_light.CastsShadow=True_ground=Model.CreateBox( New Boxf( -100,-1,-100,100,0,100 ),1,1,1,New PbrMaterial( Color.Green ) )_ground.CastsShadow=FalseJack_in_the_Box =Model.Load( "asset::Place.b3d")Jack_in_the_Box.Move( 0,2,30)Office = Model.Load("asset::OfficeBuilding.b3d")Office.Position = New Vec3f(0,0,50)_animator=Man.Animator_animator.MasterSpeed=0.5Local anim2:=_animator.Animations[0].Slice( "Idle",1,1,AnimationMode.Looping )Local anim1:=_animator.Animations[0].Slice( "Walk",2,30,AnimationMode.Looping )Local anim3:=_animator.Animations[0].Slice( "Punch",31,99,AnimationMode.OneShot )_animator.Animations.Add( anim1 )_animator.Animations.Add( anim2 )_animator.Animations.Add( anim3 )EndMethod OnRender( canvas:Canvas ) OverrideRequestRender()If _animator.Animating?.Name<>"Punch"If Keyboard.KeyHit( Key.A ) 'Punch!_animator.Animate( "Punch",1 )Else If Keyboard.KeyDown( Key.Up )_animator.Animate( "Walk",1)Man.MoveZ( speed, False )Else If Keyboard.KeyDown( Key.Down )_animator.Animate( "Walk",1)Man.MoveZ( -speed, False )Else If Keyboard.KeyDown( Key.Right)_animator.Animate( "Walk",1)Man.RotateY( -turn, False )Else If Keyboard.KeyDown( Key.Left )_animator.Animate( "Walk",1)Man.RotateY( turn, False)Else 'idle_animator.Animate( "Idle",.2 )EndifEndif_scene.Update()_camera.Render( canvas )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndJanuary 24, 2019 at 5:06 am #15998It’s hard to tell from the screen grab. If you could reproduce the problem in an example without loading any assets it would be helpful.
Other than possible asset issues, I don’t see anything the could be wrong at a glance. Maybe driver issues? Windows doesn’t seem to like Open GL sometimes.
January 24, 2019 at 7:54 am #15999Ethernaut, I went back and did a bit of experimenting. I found that the type of program that I used to create my models has some influence. For example, I made my models in Paint3D. But, I got the impression that Microsoft don’t like obj; as oddly, the obj format doesn’t exist in Microsoft’s 3d Paint unlike most programs and anything made with Microsoft’s Paint 3D and converted to obj doesn’t work well in ANY program I tried.
This was unlike Tinkercad where I made my model. After making my model in Tinkercad (virtually the same model), I downloaded it in obj format and converted it to .b3d using Fragmotion and I didn’t get the remnant and it worked perfectly. So, I think it goes back to the program that I used. I will keep experimenting to confirm this.
-
AuthorPosts
You must be logged in to reply to this topic.