Semaphore.post() can get deadlocked if it posts before the semaphore waits, not sure how to fix that yetīeta Was this translation helpful? Give feedback. I wonder if there's a way to speed this up. Yield( reattach_to_thread( "print test in thread"+ str( 1)), "completed")Īfter some testing, It does work without issue but running it 700 times is extremely slow, taking over 9 seconds. Yield( reattach_to_thread( "print test in thread"+ str( 0)), "completed") Yielding_on_thread_process = false print( "this call should now be within thread" + str(printer) + "-") #this needs to be called as yield(reattach_to_thread(),"completed") in order to work func reattach_to_thread( printer): #if reattach_to_thread is still yielding, keep emitting signals until this is false if !yielding_on_thread_process: #in the case where the yield() is called after emit_signal("thread_frame"), this is needed to ensure that eventually the yield catches the signal var yielding_on_thread_process = false func thread_process(): Var thread_active = true signal thread_frame() Here would be my solution to this which would re-merge the function to a thread but I'm not sure if there's a better way of doing what I'm trying to do: #Godot engine codeIs_colliding = true #now how do i get this function to merge back to the thread i called it from? return is_colliding Godot version 4.0.beta2.official System information Windows 10, Vulkan, RTX 2060 Issue description This code produces the following result in Godot 4 Beta 2: func ready() -> void: for i in 10. direct_space_state #need to transform the collider shape params itself:Ĭollider_shape_params. transform #merge with the physics thread in order to safely call the collision functions yield( get_tree(), "physics_frame") #need to transform the collider shape params itself:Ĭollider_shape_params. Présenté ici sous Windows, Godot Engine est un moteur de jeu 2D et 3D disponible gratuitement aussi sous Linux et macOS. set_collide_with_bodies( true)Ĭollider_shape_params. Télécharger Godot Engine : Moteur de jeu libre pour la 2D et la 3D. set_collide_with_areas( false)Ĭollider_shape_params. set_shape(col_shape.shape)Ĭollider_shape_params. Godot is an incredibly versatile engine for 2d and 3d games.Due to its pixel based measurement system, godot shines when it comes to 2d.The node based interface. Var collider_shape_params = PhysicsShapeQueryParameters. #wait until col_shape is added to the world (this also merges this with the main thread) yield(col_shape, "ready") #do whatever positioning with the col_shape and cylinder here. #But i am unable to yield on anything that was called from the original thread, so what am i to do? call_deferred( "emit_signal", "thread_done") To be more precise, the physics engine that Godot is using might want to move Godot. #my thread is meant to continue running other things in the background after this call as to not burden the main thread. Rigidbody can go through wall or floor - Godot Engine - Q&A. #upon yeilding for the result of this function the thread_func() is no longer running from within the thread var is_colliding = yield( check_if_colliding(), "completed")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |