I have two VBOs, assigned to names 1 and 2. Only 2 is being drawn. However, if I comment out VBO 2, VBO 1 is drawn with no problem. Here's the relevant code. for m in shader._models: try: # Set the model's transform matrix uniform vbo, mode = m.render_data glUniformMatrix4fv( shader.uniforms['model'], 1, GL_FALSE, np.array(m.model_matrix)) vbo.bind() # Binds the VBO. glDrawArrays(mode, 0, len(vbo)) finally: vbo.unbind() # Unbinds it. glGetting GL_ARRAY_BUFFER_BINDING in the loop gives me alternating 1 and 2s, so the buffers are binding correctly. I have done a variety of checks to ensure one object isn't being hidden by the other, for instance. The only explanation I can think of is glDrawArrays clears the whole buffer every time it draws? What the heck? … [Read more...] about glDrawArrays: Erasing the buffer between calls?
I have a project where I can shoot (with a simple projectile). Character Blueprint (generate projectile): However I would like to be able to make the projectile go towards a specific target. Projectile Blueprint (target definition): And I think that with the code below I would achieve the expected effect. Projectile Blueprint (change projectile rotation): Some links that helped me get here (I may have let something pass): https://www.youtube.com/watch?v=oyNzsbTpGqg https://forums.unrealengine.com/community/community-content-tools-and-tutorials/48896-homing-missile?77586-Homing-missile= https://answers.unrealengine.com/questions/239188/rinterp-to-doesnt-slowly-change-character-rotation.html I do not know what I'm doing wrong (based on the links above). … [Read more...] about Why is not the projectile going toward the target?
I have two gameObjects A and B. They are rotated at 90 degrees, which makes its local y axis face forward. 1st Case In this case, the local y position of B is ahead of local y position of A 2nd Case Even though their global position is same as the 1st case, we can observe here that local y position of A is ahead of local y position of B. I tried using A.transform.localPosition.y and B.transform.localPosition.y to find which is greater but it doesnt work. What can I do to find which is front in these two different cases? … [Read more...] about Unity3d: Find which gameObject is in front
I want show a menu like for an inventory item like this: At first I thought that this is a normal object in WorldSpace. I made the canvas appear like this: Unfortunately that didn't work: If the menu is far to the left, the menu is smaller than if it's shown on the right. Also, because of the perspective, it gets distorted. I had a look again where the original menu is shown. If one looks at the lines, one can see that it is not really in the World, but put straight on the screen: Therefore I thought I could do something similar with a screen space overlay in Unity. How can I set up my UI to look like this? I have changed my canvas from "World Space" to "Screen Space Overlay". This put the Panel directly in front of the camera, and the text objects were somewhere else: Also, I wondered why the canvas image fills the entire screen width. Then I googled for "unity screen space overlay size" and found the following site on which it was said: "I want to resize the canvas to 1024 x 768 but … [Read more...] about How can I place a context menu in my scene?