_id
int64 0
49
| text
stringlengths 71
4.19k
|
---|---|
42 | High resolution VR with tethered smartphone display I have an Android SmartPhone with a fairly high resolution USB C port, a USB C to USB A cable, and a Google Cardboard headset. Is it possible to develop a VR app running on a PC game engine (such as Unreal) but stream the output to the Cardboard headset by using the phone as a display? (rather than running the app entirely on the phone). For instance, if I wanted to render using a beefy NVIDIA GPU and stream the graphics over USB. What are the options here? I'm aware of this guide, which seems reasonable https uploadvr.com budget vr 101 get pc vr streaming phone Is this a use case supported by any Game Engines like Unreal Unity? |
42 | How can I remap Unreal's Editor default movement (WASD) keys for a non QWERTY keyboard I am using a French (AZERTY) keyboard, and as such my "usual" game movment keys are ZQSD instead of WASD. I have been trying to change Unreal Editor's default keys to those I am accustomed to but I can't figure out how to do it. Using UE 4.19.1 Here are the settings I've tried so far |
42 | How can I change the dimensions of collision volumes showed in UE4's physics asset tool? How can I change the dimensions of the capsule for one bone in the physics assets tool? The problem is that bones not connected by joints have overlapping collision volumes in the mannequin that comes with the starter content, which causes those body parts to apear dislocated or out of place when the simulation is running. For instance in this image the pelvis and the middle bone in the spine (Spine 2) are overlapping. So, when the simulation runs Pelvis and Spine 2 get pushed apart reducing the overlapping to a contact point. |
42 | Calling a function from Super is getting an error I am following GameDev.tv's unreal C course, but I am getting an error that is causing my compiler to fail. I'm coding a player controller, and I think I followed all the steps right but when I call the GameHasEnded() function from Super in the playercontroller.cpp, It gets an error saying anything followed by ' ' must be followed by a class or namespace. Here is my .h file which has no known compiler errors. pragma once include quot CoreMinimal.h quot include quot GameFramework PlayerController.h quot include quot ShooterPlayerController.generated.h quot UCLASS() class SIMPLESHOOTER API AShooterPlayerController public APlayerController GENERATED BODY() public virtual void GameHasEnded(class AActor EndGameFocus nullptr, bool bIsWinner false) override Here is my .cpp file with the problem. Fill out your copyright notice in the Description page of Project Settings. include quot ShooterPlayerController.h quot void GameHasEnded(class AActor EndGameFocus, bool bIsWinner) this is the problem super Super GameHasEnded(EndGameFocus, bIsWinner) I have a lot of other scripts, but I don't think they're related to the problem. I'm using Unreal 4.26, and Visual Studio 2019. I have no idea why this is getting an error, the code is exactly the same as the instructor s code. |
42 | Get Skeletal Mesh Vertex Position in Niagara I have a custom HLSL node in a simulation stage in Niagara. One of the input variables to this node is of type Skeletal Mesh and I want to get the position and normal of a given vertex on that skeletal mesh by the index of the vertex. In other words, I want to do the equivalent of the GetSkinnedVertexDataWS node, but in HLSL. Is this possible? I couldn't find any documentation on it. I tried this code bool myBool float3 VertexPosition ParticleMesh.GetSkinnedVertexDataWS lt Attribute quot Position quot gt (i, myBool, VertexPosition) float3 VertexNormal ParticleMesh.GetSkinnedVertexDataWS lt Attribute quot Normal quot gt (i, myBool, VertexNormal) where 'i' is the index of the vertex I want (from a loop), but I get the error quot 'GetSkinnedVertexDataWS SystemParticleMesh AttributePosition' cannot convert output parameter from 'float3' to 'bool' SPH Emitter, Particle GPU Compute Script quot . I also tried a few variations to no avail. How can I solve this? Edit Picking through the USH files in quot UE 4.26 Engine Plugins FX Niagara Shaders Private quot , and looking in quot NiagaraDataInterfaceSkeletalMesh.ush quot in particular, it would seem that the call should be GetSkinnedVertexWS not GetSkinnedVertexDataWS. However, when I make this change the error I get now is Engine Generated NiagaraEmitterInstance.ush(1563,3 14) Err0r X3004 undeclared identifier 'ParticleMesh' SPH Emitter, Particle GPU Compute Script, This makes no sense to me. ParticleMesh is most definitely declared as I say, it's an input to the custom HLSL node. I don't know what the error refers to when it mentions quot NiagaraEmitterInstance.ush quot either. There's a quot NiagaraEmitterInstanceShader.usf quot but no USH file. This has been an entire weekend wasted with zero progress. It doesn't help that there's next to no documentation. Nor does it help that I have to click an arbitrary parameter on the emitter on and off to reveal the error in the Niagara Log for 0.2s, whack the print screen key and paste the screenshot into Photoshop just to examine the error log, every single time I make a change. |
42 | Cannot create EAttachmentRule variable in a Blueprint struct I'm trying to add a EAttachmentRule variable in a struct but the enum doesn't appear in the list of available types I managed to create a variable in a BP by dragging the pin from an AttachActorToComponent node and promoting it to a variable. But I can't do the same thing to create a variable in a struct |
42 | Dragging and dropping sword in unreal engine 4 I am developing a 2d game using unreal engine 4 in which the user drags and drops a sword.I want the sword to follow the position of my finger.At the moment, when I drag the sword, it moves at an offset from my finger.The game has been packaged to an pad and I have set up the functionality using blueprints. Pseudo code On Drag () finger position sword position on screen on drop finger position on release from screen position of sword How do I make the sword follow the position of my finger as I drag it? |
42 | Excluding geometry from a shadow casting light in deferred rendering Is it possible to exclude geometry from a particular shadow casting light in a deferred rendering pipeline? If yes, can it be done correctly or are there limitations? This is mainly to reduce the rendering cost of each shadow casting light. In UE4 this is currently not possible and one of the staff members simply replied with a rather cryptic message "Unfortunately, this is not possible with Deferred Rendering." Since we are rendering the depth map from the light's perspective, we should be able to exclude geometry from that render pass...? Are there edge cases that I am not thinking of when combining shadow casting lights with deferred rendering? Link to forum post (and screenshot to follow in case the link goes down) https forums.unrealengine.com unreal engine feedback for epic 35667 exclude object from a specific light |
42 | Using result of ProjectWorldToScreen for DeprojectScreenToWorld does not produce initial input data I am using this logic to project a point in world space into screen space. const FVector Location FVector(1, 2, 3) FIntRect Rect Rect.Max.X ViewportSize.X Rect.Max.Y ViewportSize.Y FVector2D CurrentScreenSpaceCoords const FMatrix ViewProjectionMatrix SceneView gt ViewMatrices.GetViewProjectionMatrix() SceneView gt ProjectWorldToScreen(Location, Rect, ViewProjectionMatrix, CurrentScreenSpaceCoords) I am using this code to get the initial value back FMatrix const InvViewProjMatrix ViewProjectionMatrix.Inverse() FVector WorldPosition FVector WorldDirection FSceneView DeprojectScreenToWorld(CurrentScreenSpaceCoords, Rect, InvViewProjMatrix, WorldPosition, WorldDirection) However the result of DeprojectScreenToWorld does not produce the initial input (Location). Instead of giving me the expected vector of 1, 2, whatever , it gives me X 69.8139954,3840.00073, 250.49826 Edit I am interested in X,Y. I don't need Z. Somebody knows Why this happens? How to get the initial value back from it Thanks in advance |
42 | What folders can be safely deleted after building UE4 from source? What folders, if any, can be safely deleted, after building UE4 from source? After the build, UE4 files occupy 65 GB of disk space, which is way above comfortable for me, since I only had 72 GB free. I would like to cut the folder down to size, say at least 25 GB. Are there any files that are not required to use the Unreal Engine with full functionality? Thanks |
42 | Calling a function from Super is getting an error I am following GameDev.tv's unreal C course, but I am getting an error that is causing my compiler to fail. I'm coding a player controller, and I think I followed all the steps right but when I call the GameHasEnded() function from Super in the playercontroller.cpp, It gets an error saying anything followed by ' ' must be followed by a class or namespace. Here is my .h file which has no known compiler errors. pragma once include quot CoreMinimal.h quot include quot GameFramework PlayerController.h quot include quot ShooterPlayerController.generated.h quot UCLASS() class SIMPLESHOOTER API AShooterPlayerController public APlayerController GENERATED BODY() public virtual void GameHasEnded(class AActor EndGameFocus nullptr, bool bIsWinner false) override Here is my .cpp file with the problem. Fill out your copyright notice in the Description page of Project Settings. include quot ShooterPlayerController.h quot void GameHasEnded(class AActor EndGameFocus, bool bIsWinner) this is the problem super Super GameHasEnded(EndGameFocus, bIsWinner) I have a lot of other scripts, but I don't think they're related to the problem. I'm using Unreal 4.26, and Visual Studio 2019. I have no idea why this is getting an error, the code is exactly the same as the instructor s code. |
42 | What does the update button in the Unreal Engine launcher actually update the engine to? Unreal Engine 4 seems to have a very handy way of managing different versions of the engine mainly you get to keep several copies and choose which one to launch. That said, not having used the new launcher recently I see that I am quite behind in engine versions but where previously I had to download the new version (as can be seen by my several copies of the engine) there is now an update button on the engines. My internet is really slow so I'm curious if anyone could tell me what the update button actually does? For example, in the circled one, will it update to some 4.2.x minor version or will it update to the 4.7.2 version that I can freshly install? If I can save some bandwidth by upgrading to 4.7.2 over downloading a fresh copy that would be ideal. |
42 | Deactivate VS warning "Macro in skipped region" Since the UE4 API relies heavily on macros outside of function bodies, the IntelliSense function (not the compiler!) of Visual Studio 2017 throws a lot of warnings with update 15.7, also visible in the scroll area. Is there a possibility in the Visual Studio settings to deactivate such kind of warnings? The option to deactivate IntelliSense Tools Options Text Editor C C Advanced Disable IntelliSense will disable those warnings. However I don't want to renounce IntelliSense completely. Maybe Visual Studio offers more fine grain control over IntelliSense via its GUI or some settings file to disable only those macro warnings? EDIT The Visual Studio team recommends using a .hint file to register macros as workaround. However maintaining a separate macro list is not the way to go. You can also vote there that the VS Team works on that. |
42 | Radial circle placement of meshes How to place 10 static meshes in circular pattern so they are equaly aligned from the center ? |
42 | Calling a function from Super is getting an error I am following GameDev.tv's unreal C course, but I am getting an error that is causing my compiler to fail. I'm coding a player controller, and I think I followed all the steps right but when I call the GameHasEnded() function from Super in the playercontroller.cpp, It gets an error saying anything followed by ' ' must be followed by a class or namespace. Here is my .h file which has no known compiler errors. pragma once include quot CoreMinimal.h quot include quot GameFramework PlayerController.h quot include quot ShooterPlayerController.generated.h quot UCLASS() class SIMPLESHOOTER API AShooterPlayerController public APlayerController GENERATED BODY() public virtual void GameHasEnded(class AActor EndGameFocus nullptr, bool bIsWinner false) override Here is my .cpp file with the problem. Fill out your copyright notice in the Description page of Project Settings. include quot ShooterPlayerController.h quot void GameHasEnded(class AActor EndGameFocus, bool bIsWinner) this is the problem super Super GameHasEnded(EndGameFocus, bIsWinner) I have a lot of other scripts, but I don't think they're related to the problem. I'm using Unreal 4.26, and Visual Studio 2019. I have no idea why this is getting an error, the code is exactly the same as the instructor s code. |
42 | Map with media texture not packaging I have a simple map with a Big sphere and a pawn inside it. I use media texture and media player to play 360 video on it. But when I try to package it for windows 64 it fails while it tries to cook the map. Yes all the videos are copied to Content Movies first and then imported to UEProject as asset later. This is very crucial to our project. One of our developer have already started to build the solution in Unity just in case if packaging issue does not resolve with media player in unreal. Please help! |
42 | Unreal editor warns that Xcode is not installed on MacOS 10.14 I'm running MacOS 10.14.6. When I launch Unreal v4.25.0, I get the following warning Xcode was not detected on this Mac. Metal shader compilation will fall back to runtime compiled text shaders, which are slower. Please install latest version of Xcode for best performance, and make sure it's set as default using xcode select tool. When I try to install XCode, I'm told I need to upgrade to MacOS 10.15. I can't do this due to other software dependencies. Is there a way to compile Metal shaders from the previous version of XCode somehow? If I can't install Metal, does it matter? |
42 | Elements of a widget blueprint do not appear if I click on simulate I made a widget that contains 2 minimaps and 2 texts related to a character's variables. When I click the play button (Selected Viewport) everything happens fine Focus where I circled in pink. It turns out that when I click the Simulate button, these two texts do not appear, but the minimaps do I did a test by first clicking the play button (Selected Viewport) and then I ejected the character (which for me is the same thing as simulating, except without closing and opening the game) and the texts appeared, so my problem is only when I'm done start simulating. I would like to know how to make these 2 texts appear even if I click on simulate instead of play. |
42 | Extracting gamefiles from a game, modify it, then use it commercially, would it be illegal? I kinda get a chance to extract gamefiles from the game fortnite(assets, sounds, etc), and then I want to use them for my animation, would that be illegal. If it is illegal, what if I alter the assets, like modifying it to a voxel, and use it commercially, is it still illegal? |
42 | When and how often does Epic charge me royalties on my game? I want to know about that 5 royalties that Epic charges for the Unreal Engine if I sell games above 3000. What about if my game just made 300? Do I still need to pay 5 royalties to them? And how many times should I pay? For example, I made a game that was sold for above 3000 so I paid 5 royalties but do I still need to pay it again for the same game? |
42 | Displacement map to create terrain I am trying to figure out the best way to create a procedurally generated terrain at runtime in Unreal Engine 4. For the moment, my idea is to generate a heightmap and apply it to a plane as a displacement map, since it sounds a lot simpler than trying to procedurally generate a mesh. Is it how it is generally done? And if not, will I run into issues by doing it this way? |
42 | How to use X,Y, and Z instead of Pitch, Roll and Yaw I'm learning Unreal engine, and I'm rather disappointed because it uses pitch roll and yaw instead of the standard x, y, and z that I'm used to. Is there any way to convert this easily, or is there a preference, or do I have to get used to using y,z,x, instead of x,y,z. |
42 | Make a decal a physical object? Is there a way in the UE4 to make a decal such as a blood decal and give it a physical object? I want to do it so that I can add a sound affect when the player walks on the physical object, a box trigger wont work as when the player stands on it the sound will keep playing and repeating even if the player isn't moving. |
42 | Keyframe animation workflow Been digging through the animation tools in Unreal, trying to find a direct way to set keyframes and edit animation curves on a skeletal mesh. It seems far more complicated than I expected, generally requiring imported poses and animation that is then edited, mixed, etc... in blueprints. What I am wondering, is there an efficient way to take a skeleton, position and keyframe its bones in one place not with multiple bone transform nodes wired together then edit the resulting animation curves so as to set poses and create animation directly in the editor, or is the only reasonable way to keyframe and edit curves when using Unreal is in an external program? If it is practical, what editor panes, blueprint nodes, and game objects would I use? |
42 | Global PostProcess in UnrealEngine 4.10.2 I am new to UnrealEngine and following few tutorials to get started with. I am trying to find "Global PostProcess" (in World Outliner) in UnrealEngine 4.10, but I am not able to find it. Has it been changed compared to previous version of UnrealEngine? If so whats the alternative of it? Thanks. Update This is what I have And it doesn't look anything like whats there in this link (see Assigning to a Post Process Volume) https docs.unrealengine.com latest INT Engine Rendering PostProcessEffects PostProcessMaterials PostProcessDemoMaterialOverview index.html |
42 | Why can't this event call its parent event? It's me... Back again... with another Unreal problem... I have an Event in my Parent Class called Overridable PreDialogueScreenEnter I have overridden the same Event in a Child Class Yet when I attempt to call the parent event from the child class, the option is greyed out. Tl Dr Why call parent event not work |
42 | How can I realistically simulate audio for multi sensor processing? I am performing audio simulations in Unreal Engine 4. Ideally, I need realistic audio propagations. So microphones at multiple locations will experience propagation delays related to their distance from a sound source. Basically to be able to do spatial signal processing with a microphone array. I have done some experiments with the Steam Audio plugin but I don't think that the propagation delays are built in. Some research points to needing to add the propagation delays in post processing, but if the sound source is moving, then the problem becomes difficult. How can I implement this in my project? |
42 | How do you spawn a component from a class in UE4? Background I'm working on a shooter game at the moment and I'm trying to spawn an Actor Component for the weapon currently in use, in order to have less Actors to keep track of. The problem with this is that I can't easily switch out components on the fly, without making a separate function for each weapon. Question Is there currently any way to spawn a component with blueprints from a class like you would do with an Actor? |
42 | How to call an event of level blueprint from NPC blueprint? I have the following situation 1 NPC that follows a path containing 3 parts. Target Point 1, Tower and Target Point 2. It turns out that the first NPC that passes through the tower destroys it. This destruction is not instantaneous. The tower has 100 hit points and while in contact with the NPC, it loses 10 life points every second. With this, the next NPCs will only have to go to Target Point 1 and finally to Target Point 2. I created a boolean variable for target control (varTowerDestroyed). So if it is false, the second target becomes the tower, otherwise it becomes the target point 2. Blueprint showing the variable (varTowerDestroyed) being set to true, right after the tower's destruction Display of the control in the target definition It turns out that each NPC has its own variables, so there's no use in defining the value of the variable of just one of them. I would need a variable that would control all at the same time. I thought of doing the verification based on a variable of the own tower, but as the tower will be destroyed, I imagine the variable will disappear. Impossible to verify At the Level Bueprint I created an event that will be called soon after the tower's destruction. This event will set the Boolean variable to true, setting all Boolean variables of the NPCs that are created and still generated to be true I would calmly call an event if the event was in the blueprint of the tower, but being on the blueprint level I was unsuccessful. I thought about using the sleep function. I also thought about creating an actor who was sort of an actor manager (I still want to, but only when I start using HUD). I also thought about doing a check of the existence of tower actors, but this I do not know how to do. Links from places I searched https answers.unrealengine.com questions 78622 how can i call an event in my level blueprint from.html https answers.unrealengine.com questions 702964 how can i call a event from actor blueprint in lev.html EDIT 1 (Attempt made based on 2 videos I've seen) Link of videos https www.youtube.com watch?v k MAALv3P Y https www.youtube.com watch?v IbiocEDwosw I tried to use the Event Dispatcher. I created an Event Dispatcher called Disp, in the NPC blueprint. Soon after I set it on the Level Blueprint. Level Blueprint Nothing happens, nor the impression. |
42 | Create a instance of a C class within a blueprint I'd like to create an instance of a C class in a blueprint. That's my current approach, but the instance is None. Why? |
42 | Unreal Engine Linux Support I use multiple game Engines, but havn't used Unreal engine for quite a while, Now with the recent changes in Unreal Engine there are quite some interesting features which would be interesting to use in games. However I also recently heard that UE4 recently dropped build support for Linux. So my main 2 questions are 1. Did UE4 truly drop Linux build support? and if so 2. Is there a way to get Linux build support in the latest version of UE4? I can check the first question myself but due to the large engine size and my slow network connection this would take very long, so I figured it would save a lot of time if someone who already has the newest version installed knew the answer. |
42 | How can I realistically simulate audio for multi sensor processing? I am performing audio simulations in Unreal Engine 4. Ideally, I need realistic audio propagations. So microphones at multiple locations will experience propagation delays related to their distance from a sound source. Basically to be able to do spatial signal processing with a microphone array. I have done some experiments with the Steam Audio plugin but I don't think that the propagation delays are built in. Some research points to needing to add the propagation delays in post processing, but if the sound source is moving, then the problem becomes difficult. How can I implement this in my project? |
43 | Why does Forge not find my texture for my custom background? I am creating a minecraft mod that improves the main menu for my minecraft server. At first I wanted to create the background, but somehow when I try to start minecraft it closes and I get a nullpointerexception because minecraft didn't find my background. public class ThundrialMenu extends GuiScreen Override public void initGui() Override public void drawScreen(int mouseX, int mouseY, float partialTicks) Random rnd new Random() int background rnd.nextInt(3) 1 String backgroundLocation " assets thundrial gui Background" background ".png" this.drawBackground(mc.renderEngine.getTexture(new ResourceLocation(backgroundLocation)).getGlTextureId()) super.drawScreen(mouseX, mouseY, partialTicks) Override public void updateScreen() super.updateScreen() This is the folder where the pictures are located Why does Minecraft not find those pictures? |
43 | How can I model a "weapon overheating" mechanic? I want to create a weapon overheating system very similar to the plasma rifle in Halo. You can watch a video of the plasma rifle firing. What I want to do is to create a flexible logic that can be used for multiple weapons for different in game feelings. Here is my proposed system Create a bar that is split from 0 100. Each bullet has a heat value as an integer. Every bullet adds this value to the bar. The bar has a cooldown set as some value per second. If the bar goes over 100 with any bullet fire the bullet still shoots but then the weapon is deactivated for a period defined as it's "cooldown." Now this system is very simple but visually it will be very linear, with a simple growth and decay. I wanted to try to create a more exponential system that would mean the bar would jump quickly to the middle then remain and hover near the top hot bit of the bar for a long period to create a sense of anticipation just before it overheats. What would be a good formula to achieve that result? |
43 | screen space or pixel space for a GUI? I want to design a very simple GUI for my game using OpenGL. So far, every GUI implementation I have seen uses pixel space coordinates ( x range 0.0 to screen width and y 0.0 to screen height) Why aren't they simply using screen space coordinates ? ( x and y range 1 to 1) With screen space coordinates we would'nt have any issue with screen resizing, plus we won't have to transform coordinates for OpenGL since we use same space. So why every GUI engine uses pixel space ? |
43 | How to display Render Target live to HUD widget in UE4 I'm making a security camera system in Unreal Engine 4. It allows the player to 'activate' the monitor, which should display the Render Target texture or the material made from it on the HUD. However, that just doesn't work. There's just no image when I try to play it. Nothing appears on the screen. I'm using blueprints btw, not C . And yes, I did check and make sure that it's not the part that displays the HUD that's going wrong, it's the displaying of the render target to the UI widget. To display it, i've tried using the image component in the UI widget. Can anyone help? |
43 | Why does Forge not find my texture for my custom background? I am creating a minecraft mod that improves the main menu for my minecraft server. At first I wanted to create the background, but somehow when I try to start minecraft it closes and I get a nullpointerexception because minecraft didn't find my background. public class ThundrialMenu extends GuiScreen Override public void initGui() Override public void drawScreen(int mouseX, int mouseY, float partialTicks) Random rnd new Random() int background rnd.nextInt(3) 1 String backgroundLocation " assets thundrial gui Background" background ".png" this.drawBackground(mc.renderEngine.getTexture(new ResourceLocation(backgroundLocation)).getGlTextureId()) super.drawScreen(mouseX, mouseY, partialTicks) Override public void updateScreen() super.updateScreen() This is the folder where the pictures are located Why does Minecraft not find those pictures? |
43 | Does a successful attempt count as an attempt? I'm writing a video game and I'd like to know if I should include the "successful" attempt in the count of "total attempts". For instance, in a clay shooting game, if the player needs four shots before they hit the target bullet one miss bullet two miss bullet three miss bullet four hit Does it equate to three attempts, or four attempts? What text do I need to write at the end of the round? You needed three attempts to hit the target! or You needed four attempts to hit the target! |
43 | HTML5 Game (Canvas) UI Techniques? I'm in the process of building a JavaScript HTML5 game (using Canvas) for mobile (Android iPhone WebOS) with PhoneGap. I'm currently trying to design out how the UI and playing board should be built and how they should interact but I'm not sure what the best solution is. Here's what I can think of Build the UI right into the canvas using things like drawImage and fillText Build parts of the UI outside of the canvas using regular DOM objects and then float a div over the canvas when UI elements need to overlap the playing board canvas. Are there any other possible techniques I can use for building the game UI that I haven't thought of? Also, which of these would be considered the "standard" way (I know HTML5 games are not very popular so there probably isn't a "standard" way yet)? And finally, which way would YOU recommend use? Many thanks in advance! |
43 | Logic only GUI library I'm not sure whether this place is the correct for asking this. If it's the wrong place I'm sorry, please tell me if so! I'm making a small game for fun which would uses an own engine with OpenGL and Vulkan as underlying renderer implementation. The engine itself is targeted for Mono .Net. Currently I'm not yet there but I'll come to the point where I'm pushed to implement some kind of GUI (I'm thinking ahead because of good design). I already searched the Internet for render independent GUI systems but I wasn't lucky yet. As result I thought about how I could implement the GUI on my own and came to the conclusion a independent implementation is needed which takes care only for layout, positioning of GUI objects with responding to inputs. another implementation is needed which only takes the results of calculations for rendering (the renderer) Before I start inventing the whole wheel new I simply want to know Is it a correct approach to doing it this way? Is there a different common approach doing what I described? |
43 | AntTweakBar doesn't register SFML mouse events I'm trying to add GUI for easier level editing in our game engine. We're using SFML for all the basic stuff (window management, input events etc). I've chosen AntTweakBar because it is a well known library with a few examples around. I was following the tutorial at AntTweakBar's website I was able to draw a simple bar with those example codes. However, mouse events received by SFML are not registered by AntTweakBar's TwEventSDL() function. Here is an example code for Input sf Event event while ( pWindow gt pollEvent(event)) Check if the event should be handled by AntTweakBar int handled TwEventSFML( amp event, 2, 3) for SFML version 2.3 if (!handled) switch (event.type) case sf Event MouseButtonPressed To check whether SFML received mouse button events properly if (event.mouseButton.button sf Mouse Button Left) std cout lt lt "Left button pressed" lt lt std endl std cout lt lt "x " lt lt event.mouseButton.x lt lt std endl std cout lt lt "y " lt lt event.mouseButton.y lt lt std endl else To check whether TwEventSFML received events std cout lt lt "FINALLY!" lt lt std endl When I press buttons, I can see "FINALLY!" showing up. I can also see that my mouse clicks are received by SFML. However, when I click on an AntTweakBar element (be it a button or help section) it doesn't register it. (Also, I can't see "FINALLY!" when I use the mouse). Any help or ideas will be appreciated. |
43 | How to make a scrollbar? I am making my own UI for my game, no libraries used, basic UI with simple controls and I am almost done. Now, let's say I need to display lots of information, controls or items which obviously won't fit in the screen space. I must use a scroll bar to achieve this task. But how does one make a scroll bar? I just don't understand how to do it. The concept for vertical and horizontal scrollbars is the same. Virtually there is a huge plain with data, but we can only display cut of it all in a such by such screen space. We use scrollbars to move that viewable rectangle across our giant plain. The scrollbar itself is a displayed line texture sprite on the side of the screen which has a button inside that we can interact with by moving it across the scrollbar. The button is dynamic, its size is relative to total item count and possible item count that can be shown in given space. Our button shrinks when there are more items added, expands when items are getting removed and the whole scrollbar disappears when all the items can be successfully displayed at once. I can't seem to find online tutorials on this matter. Perhaps it's so basic for everyone except me? Still can't wrap my head around it... |
43 | Tech Tree layouts for games? I'm trying to do a tech tree GUI for my game, but i have limited width and the tree has alot of branches, the problem is if I make them small to fit the width, the tech tree is too small to read. For example the AOE one is very large (in width) I could allow scroll bar but as its web based, scrolls are quite ugly. So i was wondering how to deal with branches which slowly cause the tech tree to get wider as you go down the tech tree and how you would fit such a design in a limited space. Are there different known designs for tech trees that any one knows of so i can look at their types. I don't know the names given to the types of tech tree layouts. But am hoping to find one that is not overly complex for the user aswell. |
43 | What is the best way to make a main menu system? I know that's it's easy to make buttons that highlight when you move your mouse over them, but when it comes to sub menus I'm kinda stuck. Anyone got some tips on the best way to have a main menu with sub menus? (like Singleplayer Load Save Save 1 5? Start game etc.) |
43 | What is the specific name of this UI component? Is there a specific name for this kind of ui component? Sometimes it only renders a symbol (without text) so using name like TextComponent is imo not very fitting. |
43 | How to create guides to off screen objects? I've played Metroid Blast on Wii U, and would like to build one of its features in a three.js game. The feature is if an opponent is out of view, a guide is displayed showing the direction of the opponent. An example of it is here (Image source) Notice the small circles with arrows in the left side. How could I have a similar feature in my game? |
43 | How to create game database editor interface like Age of Empires' AGE Age of Empires had this powerful AGE (Advanced Genie Editor) tool to let players mod the game data with ease. You could see all the game's databases through this tool and play with them to make your own mods in a pretty straightforward way, which I suppose was also used by the devs themselves to author their data. I was wondering how can I implement a similar editing interface for my game database? Are there tricks like this that Godot, Unity and Unreal users use to author their data? I feel like I missed something because no popular engine seem to support what I'm looking for out of the box. If I can't do it in engine, how should I go to make such a tool myself? |
43 | How do I attach UI data to logic data? I'm attempting to write an inventory system(C , doesn't need to be huge), that later on should be able to be drawn in a GUI. In the file structure, I think it would be best to put both information about the item itself and references to graphics, etc. in one file. But how does that translate into code? How should I tell the renderer, for example which sprite to draw for which item and where to do that. Should I only have the CInventory and the CItem class, containing both logic and sprite information, or should I create separate logic and GUI inventory(in this case meaning both CInventory and CItem) classes which are then linked by a common item id for example? Answers are always appreciated ) |
43 | Immediate GUI yae or nay? I've been working on application development with a lot of "retained" GUI systems (below more about what I mean by that) like MFC, QT, Forms, SWING and several web GUI frameworks some years ago. I always found the concepts of most GUI systems overly complicated and clumsy. The amount of callback events, listeners, data copies, something to string to something conversions (and so on) were always a source of mistakes and headaches compared to other parts in the application. (Even with "proper" use of Data Bindings Models). Now I am writing computer games ). I worked with one GUI so far Miyagi (not well known, but basically the same Idea as all the other systems.) It was horrible. For real time rendering environments like Games, I get the feeling that "retained" GUI systems are even more obsolete. User interfaces usually don't need to be auto layouted or have resizable windows on the fly. Instead, they need to interact very efficiently with always changing data (like 3d positions of models in the world) A couple of years ago, I stumbled upon "IMGUI" which is basically like an Immediate Graphics mode, but for user interfaces. I didn't give too much attention, since I was still in application development and the IMGUI scene itself seemed to be not really broad nor successfull. Still the approach they take seem to be so utterly sexy and elegant, that it made me want to write something for the next project using this way of UI (I failed to convince anyone at work (...) let me summarize what I mean by "retained" and "immediate" Retained GUI In a separate initialization phase, you create "GUI controls" like Labels, Buttons, TextBoxes etc. and use some descriptive (or programmatical) way of placing them on screen all before anything is rendered. Controls hold most of their own state in memory like X,Y location, size, borders, child controls, label text, images and so on. You can add callbacks and listeners to get informed of events and to update data in the GUI control. Immediate GUI The GUI library consists of one shot "RenderButton", "RenderLabel", "RenderTextBox"... functions (edit don't get confused by the Render prefix. These functions also do the logic behind the controls like polling user input, inserting characters, handle character repeat speed when user holds down a key and so on...) that you can call to "immediately" render a control (doesn't have to be immediately written to the GPU. Usually its remembered for the current frame and sorted into appropiate batches later). The library does not hold any "state" for these. If you want to hide a button... just don't call the RenderButton function. All RenderXXX functions that have user interaction like a buttons or checkbox have return values that indicate whether e.g. the user clicked into the button. So your "RenderGUI" function looks like a big if else function where you call or not call your RenderXXX functions depending on your game state and all the data update logic (when a button is pressed) is intermangled into the flow. All data storage is "outside" the gui and passed on demand to the Render functions. (Of course, you would split up the big functions into several ones or use some class abstractions for grouping parts of the gui. We don't write code like in 1980 anymore, do we? )) Now I found that Unity3D actually uses the very same basic approach to their built in GUI systems. There are probably a couple of GUI's with this approach out there as well? Still.. when looking around, there seem to be a strong bias towards retained GUI systems? At least I haven't found this approach except in Unity3D and the original IMGUI community seems to be rather .... .. quiet. So anyone worked with both ideas and have some strong opinion? Edit I am most interested in opinions that stem from real world experience. I think there is a lot of heated discussions in the IMGUI forum about any "theoretical weakness" of the immediate GUI approach, but I always find it more enlightening to know about real world weaknesses. |
43 | Error in DRAW GUI event on android. (GameMaker) Image of the game on a mobile phone As you can see the maze (draw event) has been resized correctly. But the yellow post it (draw GUI event) has not been scaled or displayed in the correct location (center of the screen). Same thing with GUI layout (draw GUI event). Because this is a small stage room (size) I do not use the artifice of views, I thought that could be because of that the problem, but I enabled the views and did not get any different result. Picture of the game on a computer (like it should be on the phone) OBS One information that can help you to help me solve the problem, is that to draw the post it I use the following code draw GUI event draw sprite(spr Post,0,640,360) . 640 is the half screen width of the game and also the room, 360 is half the height of the game screen and also the room. It seems that somehow the room on the cell phone is different size than 1280x720. I do not put the following code draw GUI event draw sprite(spr Post,0,room width 2,room height 2), because there are much larger phases that need views, so the post it needs to be in the center of the screen of the player, and with this code it ends up being in the center of the phase. I tested the game on Bluestacks and it did not happen the same as on the phone. |
43 | Unity 5 Dynamic Button Creation with Event Parameters According to the documentation, you cannot instantiate buttons except via prefab instantiate. http docs.unity3d.com Manual HOWTO UICreateFromScripting.html You might wonder why we don t have a API methods to create the various types of controls, including visuals and everything. The reason is that there are an infinite number of way e.g. a button could be setup. Does it use an image, text, or both? Maybe even multiple images? What is the text font, color, font size, and alignment? What sprite or sprites should the image use? By letting you make a prefab and instantiate that, you can set it up exactly the way you want. And if you later want to change the look and feel of your UI you can just change the prefab and then it will be reflected in your UI, including the dynamically created UI. What I'm trying to do is dynamically create a table of buttons, each one going to a level in my game. The amount of button depends on how many levels the user has unlocked. I can create a prefab for a button, that's fine, but how do I go about assigning an OnClick event to each of these buttons with an appropriate 'levelIndex' parameter? I can not find any scripting method to do this, and I'd like to avoid hacky solutions like creating 50 buttons and only showing the first N children. |
44 | Why isnt setting the global position working? Previously my items were relative to the player by node hierarchy. But for items like bombs this is not ideal so i tried to add the items to the world scene, but when i try to adjust the position of the item to the players position it doesnt work and i see the sword in the top left corner of the screen the worlds origin. Entity Script func use item(item) var newitem item.instance() newitem.own self newitem.global position global position not setting the position of the item correctly newitem.add to group(str(newitem.get name(), self)) get node( quot .. quot ).add child(newitem) if get tree().get nodes in group(str(newitem.get name(),self)).size() gt newitem.maxamount newitem.queue free() Sword Script func ready() type own.type anim.connect( quot animation finished quot ,self, quot destroy quot ) anim.play(str( quot swing quot ,own.spritedir)) if own.has method( quot state swing quot ) own.state quot swing quot func destroy(animation) if own.has method( quot state swing quot ) own.state quot default quot queue free() It seems like it should work but with an engine like godot there could be several reasons why a certain thing is not working. https github.com MonkeyToiletLadder wendingo could it be that in my animation player i set the sword positions as key frames and thats why its not working? |
44 | Godot Get button node in click event not working How we can get the button reference on the event function that is connected? My connect signals never works extends PanelContainer onready var hbox container ScrollContainer HBoxContainer var btn func ready() createbutton() func createbutton() btn Button.new() btn.set name("button 1") btn.text "button 1" hbox container.add child(btn) btn.connect("toggled", self, "button toggled", btn ) func button toggled(toggled, target) print("which button ", target.get name()) if toggled true print("Button ist pressed") else print("Button is released") |
44 | Add a sound to all the buttons in a project Is there an option on the texture button or something like that where you can specify a sound to be played on button press. I have created a global sound manager but for the button presses, I have to manually code it everywhere the script has a button pressed signal. Or some kind of logic that when a button is pressed anywhere in the project, sound manager plays a particular sound. |
44 | How can I remove Godot's splash screen? I started using Godot lately (mostly because the editor supports Linux). There is one thing that bothers me the Godot splash screen. I know that I can (somehow) remove it and I saw something about C but I'm not sure. Is there any way to remove it? Or maybe it is only in the editor and once you export the game it'll disappear? |
44 | Lagging problem with chunk creation in Godot We are developing a 2D game in Godot and we are stuck while trying to divide the map in chunks. Namely, the scene is a forest, where trees spawn positions were generated by noise since the trees are too many to be loaded altogether, we created a Chunk node, which only instances trees contained in it, and gets instanced and deinstanced according to player's position. Though, this does not seem to be enough each time a new chunk is to be instanced, we get a lag spike. How can we improve this? This is the script attached to Chunk extends Node2D var noise func ready() randomize() self.name str(global position) noise get node(" root global").noise LoadTrees() func LoadTrees() var x 38 while x lt 39 var y 14 while y lt 15 if noise.get noise 2d(global position.x float(10 x),global position.y float(12 y)) gt 0.07 InstanceTree(Vector2(10 x rng.randi range( 3,3),12 y rng.randi range( 3,3)),self) y 1 x 1 func on Exit body exited(body) if body.name "Player" call deferred("free") func on AreaLeft body entered(body) if body.name "Player" var NewChunkPos global position 2 Vector2(380,0) get parent().InstanceChunk(NewChunkPos) func on AreaRight body entered(body) if body.name "Player" var NewChunkPos global position 2 Vector2(380,0) get parent().InstanceChunk(NewChunkPos) func on AreaDown body entered(body) if body.name "Player" var NewChunkPos global position 2 Vector2(0,170) get parent().InstanceChunk(NewChunkPos) func on AreaUp body entered(body) if body.name "Player" var NewChunkPos global position 2 Vector2(0,170) get parent().InstanceChunk(NewChunkPos) The functions the script calls from its parent's script go as follows func InstanceTree(pos,Parent) var tree Tree.instance() tree.position pos tree.name str(global position) " tree " str(pos) Parent.call deferred("add child",tree) func InstanceChunk(NewChunkPos) if not self.has node(str(NewChunkPos)) var NewChunk Chunk.instance() NewChunk.global position NewChunkPos NewChunk.name str(NewChunkPos) call deferred("add child",NewChunk) |
44 | Godot How does the VisibilityEnabler work? Visibility Enabler I'm confused about the use of the Visibility enabler node in godot. I've read the documentation and tried it out both stand alone and as a child without success. I set the parent to print a String during its process function. Despite adding the enabler it continued to print despite being off screen. How do I set it up so that It actually disables anything? |
44 | How do I get the GUI to draw above the kinematic bodies when their z index is changed? Currently the Labels in the GUI are below the player and other objects, so the player appears above them. How can this be fixed? extends Node var load 1 true onready var level preload("res scenes levels Level.tscn") var Level null func ready() Level level.instance() add child(Level) move child(Level, 0) VisualServer.canvas item set z index( GUI Label3, 4000) print("I'm here") func process(delta) getallnodes(self) pass func set z index(node) for N in node.get children() if N.get class() "KinematicBody2D" N.z index N.position.y func getallnodes(node) for N in node.get children() if N.get child count() gt 0 and N.get class() ! "RigidBody2D" and N.get class() ! "KinematicBody2D" and N.get class() ! "StaticBody2D" getallnodes(N) else if N.get class() "KinematicBody2D" or N.get class() "RigidBody2D" setZOrder kine(N) print(" " N.get name()) if N.get class() "StaticBody2D" setZOrder kine(N) print(" " N.get name()) elif N.get class() "Sprite" setZOrder(N) print(" " N.get name()) func setZOrder kine(node) for N in node.get children() if N.get class() "Sprite" var myPos N.get global transform().get origin() var mySize N.get texture().get height() var bottomOfSprite (mySize N.get scale().y N.get parent().get scale().y) (2 N.vframes) N.get parent().z index (myPos.y bottomOfSprite) func setZOrder(N) var myPos N.get global transform().get origin() var mySize N.get texture().get height() var bottomOfSprite (mySize N.get scale().y) (2 N.vframes) N.z index (myPos.y bottomOfSprite) func physics process(delta) if(Level.get node("Player")) GUI Label.text "Velocity " str(Level.get node("Player").velocity.length()) ", " str(Level.get node("Player").velocity.x) ", " str( Level.get node("Player").velocity.y) GUI Label2.text "Position " str(Level.get node("Player").position.x) ", " str(Level.get node("Player").position.y) ", " str(Level.get node("Player").z index) GUI Label3.text "Sword " "rotation " str(Level.get node("Player").rotation) GUI Label4.text "stamina" str(Level.get node("Player").stam.current) "attack charge " str(Level.get node("Player").stab.charge.current) "countdown " str(Level.get node("Player").stab countdown 0 ) "cooldown " str(Level.get node("Player").stab cooldown 0 ) |
44 | Godot on Area2D area entered not detecting In my Scene I have a Node2D. I then Instanced the Player and Area2D nodes. The Area2D has a signal pointing to itself that prints test when run. Here is the Code For the Area2D. Nothing happens when an object enters the Area2D. extends Area2D Declare member variables here. Examples var a 2 var b "text" Called when the node enters the scene tree for the first time. func ready() pass Replace with function body. Called every frame. 'delta' is the elapsed time since the previous frame. func process(delta) pass func on Area2D area entered(area) print('test') Level Scene Player Area 2D Google Drive Link to Project https drive.google.com drive folders 1OG3BBqKJzC3Je r5eQdqiFUp7PzzBmt1?usp sharing |
44 | How do I decrease the scale of an instanced node or scene? I'm trying to decrease size of instanced RigidBody2D scene, through code. With scale(), I'm trying to decrease the size of the image sprite that's attached to the RigidBody2D. The problem is, it's not working. No matter how much I try to scale down, the size of the blood drop circle remains the same. const blood druple scn preload("res Scenes blood.tscn") func spawnBlood() var newBlood Blood druple scn.instance() rotationAdd rotationAdd 30 if(switchBloodSize 0) set scale(Vector2(2,1)) This part is my problem print("blood size ", newBlood.get scale()) add child(newBlood) switchBloodSize 1 elif(switchBloodSize 1) newBlood.scale(Vector2(0.5,0.5)) This part is my problem print("Blood size ", newBlood.get scale()) add child(newBlood) switchBloodSize 0 newBlood.set pos(Vector2(100,100)) rotate(rotationAdd) As you can see, I have two different if conditions, each with a different scale() and size. Sadly, both remain the same size. The strange part is that it does display the scale values as been altered, yet the newBlood instance is not visually changing. Why is this? |
44 | Is it possible to have a script built in into a custom resource? Here's a rudimentary custom resource extends Resource export(Resource) var scr I can drag a pre made .gd script into this exported property in Inspector, and it works as intended. I can click on the exported property field and embed a resource (like "New ShaderMaterial"), and it would also work as intended, and I would be able to edit that sub resource normally. However, if I click on the exported property and select "New GDScript", there doesn't seem to be a way to open the new gdscript for editing. Is it possible to embed a gdscript sub resource the same way you can embed a different sub resource? |
44 | Godot Engine Why is baking light making my scene darker? I have an interior scene with some windows. The light is from an OmniLight near the ceiling, default environmental light from outside, and a desk lamp with emission. Without baking light, the scene looks like this Consistent with the documentation for emission, the desk lamp is not affecting the surrounding objects. I want to bake the light to see the lamp's effect and to support low end hardware. I followed the baked lightmaps tutorial and set the BakedLightmap's extents to encompass the entire room. After baking, the scene looks like this I can see the lamp's light, as expected, but now everything is too dark. It is unclear to me from Godot's documentation if scenes include indirect light without baking. I have tried this with the OmniLight set to bake quot all quot and only indirect light. What am I missing here? UPDATE 10 April 2021 The problem seems to be that baking environmental light isn't working as expected. I was using Godot 3.2.3 now I'm using 3.3rc8. That gives the BakedLightmap options for environmental light, but the problem remains. I began troubleshooting by shuttering all the light sources as follows Hid the OmniLight, and set its quot Bake Model quot property to quot disabled quot Unchecked quot use in baked light quot for the desk lamp Set the default environment's background and ambient energy to 0 Set the BakedLightmap's quot environment mode quot to quot Disabled quot , verified quot Min Light quot is set to pure black, and cleared the quot Light Data quot When I run the game, I get exactly what I expect a black screen. If I bake light under these conditions, I continue to get a black screen, as expected. Here's where things get screwy. When I set the BakedLightmap's quot environment mode quot to quot Scene quot with the environment still without any light I get dim illumination. |
44 | Godot play video after file load I used WebM video in my game but it's lagging. The audio is few secs delayed then video. Is there any way to load the video first then play so that the lagging doesn't occurs |
44 | How do I attach the Visual Studio Code debugger to Godot At 3.0 Godot now supports C and encourages the use of Visual Studio Code to edit this code. It is not clear how to attach VS Code so that we an apply breakpoints and debug a project at runtime. I am running A recent build of Godot from master (b49ca94 with mono for 64 bit windows) Visual Studio Code 1.21.0 with these extenstions C 1.14 Mono Debug 0.15.8 Mono 5.10.0 |
44 | How can I get the NodePath that points to the property, rotation, of the parent node? The 2nd arg in interpolate property takes a NodePath, but str of a path to a prop seems fine too. So I'd expect this to work var rotation node path " root Main Boid1 InitialRegion Bird rotation" but I'm getting the error ERROR interpolate property Condition ' !prop valid ' is true. returned false func lerp rotation() add child(tween) var rotation node path str(parent.get path()) " rotation" var current Math.smallest equal angle(parent.rotation) var target Math.smallest equal angle(target rotation) var duration 1 print(current, ' ', target, ' ', rotation node path) tween.interpolate property(parent, rotation node path, current, target, 1, Tween.TRANS LINEAR, Tween.EASE IN OUT) tween.start() |
44 | Godot Collision for character teleportation I'm currently working on a little game to discover Godot game engine. It's a Top Down game and I want my character to be able to teleport through walls. I thought to dupplicate my character's collision box and to set its position to the teleportation's position but I didn't find a way to check if there is a collision to this new position. Any advise? |
44 | GET and POST requests in gdscript How do I perform get and post requests from Gdscript in Godot? I am trying to get a map API and use it in the game. |
44 | Add a sound to all the buttons in a project Is there an option on the texture button or something like that where you can specify a sound to be played on button press. I have created a global sound manager but for the button presses, I have to manually code it everywhere the script has a button pressed signal. Or some kind of logic that when a button is pressed anywhere in the project, sound manager plays a particular sound. |
44 | How do I add an object to the node tree at a specific position I'm making a skiing game, and a part of that is programmatically adding snow to the scene in a specific place. It will all be the child of a single node. I was looking through the Flappy Bird code but when it instances a scene, it only uses the function add child(). There doesn't seem to be a way to set its position. Here is the project on github. |
44 | How do i get effect when gems come together in godot? I'm create gems puzzle game, In my game there is requirement that 2x2 matrix gem will group and then it will convert in power gem. check below image. I'm new in game development, so anyone can point me out ? any suggestion or link will be helpfull. Thank you |
44 | Godot tween animation playing order I'm making a three in line game with godot, but i'm having an issue. First time when swapping cells, the animation of swapping and the elimination of cells (in the case of making 3 or more cell aligned in a line) played both at the same time. So i refactored a bit the code, now i have queue for each cell that manages the animation to be played one by one. Now my problem is this, the cells that the player swaps, they do fine, the play the swap animation then the elimination animation. the problem are the other cells in the line, those get removed as the first cells are playing the swap animation first and then elimination animation. Step 1 Step 2 cells in line remove animation nothing swaped cells swap animation remove animation in case i didn't explained well i left a more graphic description of the flow of the animation steps. this is how i want the animation to be played Step 1 Step 2 cells in line nothing remove animation swaped cells swap animation remove animation I'm not sure how to solve the problem, each cell manages their animations in the queue. |
44 | Getting Parser Error The identifier "delta" isn't declared in the current scope. in godot this is the whole code extends KinematicBody signal health updated(health) signal killed() var speed 10 var acceleration 10 var gravity 0.2 var jump 5 var mouse sensitivity 0.3 var direction Vector3() var velocity Vector3() var fall Vector3() export (float) var max health 100 onready var health max health setget set health onready var head Head func ready() Input.set mouse mode(Input.MOUSE MODE CAPTURED) func input(event) if event is InputEventMouseMotion rotate y(deg2rad( event.relative.x mouse sensitivity)) head.rotate x(deg2rad( event.relative.y mouse sensitivity)) head.rotation.x clamp(head.rotation.x, deg2rad( 90), deg2rad(90)) func physics process(delta) direction Vector3() move and slide(fall, Vector3.UP) if not is on floor() fall.y gravity onready var invulnerability timer invulnerabilitytimer func damage(amount) if invulnerability timer.is stopped() invulnerability timer.start() set health(health amount) func kill() pass func set health(value) var prev health health health clamp(value, 0, max health) if health ! prev health emit signal ("health updated", health) if health 0 kill() emit signal("killed") if Input.is action just pressed("jump") and is on floor() fall.y jump if Input.is action pressed("move forward") direction transform.basis.z elif Input.is action pressed("move backward") direction transform.basis.z if Input.is action pressed("move left") direction transform.basis.x elif Input.is action pressed("move right") direction transform.basis.x direction direction.normalized() velocity velocity.linear interpolate(direction speed, acceleration delta) velocity move and slide(velocity, Vector3.UP) |
44 | How to change FPS when using a sprite sheet and AnimationPlayer? With AnimatedSprite it is easy to change FPS. Is there a convenient way to do that with AnimationPlayer? |
44 | Godot Get button node in click event not working How we can get the button reference on the event function that is connected? My connect signals never works extends PanelContainer onready var hbox container ScrollContainer HBoxContainer var btn func ready() createbutton() func createbutton() btn Button.new() btn.set name("button 1") btn.text "button 1" hbox container.add child(btn) btn.connect("toggled", self, "button toggled", btn ) func button toggled(toggled, target) print("which button ", target.get name()) if toggled true print("Button ist pressed") else print("Button is released") |
44 | Godot Engine Why is baking light making my scene darker? I have an interior scene with some windows. The light is from an OmniLight near the ceiling, default environmental light from outside, and a desk lamp with emission. Without baking light, the scene looks like this Consistent with the documentation for emission, the desk lamp is not affecting the surrounding objects. I want to bake the light to see the lamp's effect and to support low end hardware. I followed the baked lightmaps tutorial and set the BakedLightmap's extents to encompass the entire room. After baking, the scene looks like this I can see the lamp's light, as expected, but now everything is too dark. It is unclear to me from Godot's documentation if scenes include indirect light without baking. I have tried this with the OmniLight set to bake quot all quot and only indirect light. What am I missing here? UPDATE 10 April 2021 The problem seems to be that baking environmental light isn't working as expected. I was using Godot 3.2.3 now I'm using 3.3rc8. That gives the BakedLightmap options for environmental light, but the problem remains. I began troubleshooting by shuttering all the light sources as follows Hid the OmniLight, and set its quot Bake Model quot property to quot disabled quot Unchecked quot use in baked light quot for the desk lamp Set the default environment's background and ambient energy to 0 Set the BakedLightmap's quot environment mode quot to quot Disabled quot , verified quot Min Light quot is set to pure black, and cleared the quot Light Data quot When I run the game, I get exactly what I expect a black screen. If I bake light under these conditions, I continue to get a black screen, as expected. Here's where things get screwy. When I set the BakedLightmap's quot environment mode quot to quot Scene quot with the environment still without any light I get dim illumination. |
44 | In Godot browser game, is it possible to let the player download a file? I have a Godot game exported to the browser. I want to let the player export some data and let it save the data as a file on their PC, as if they were downloading a file from the Web. Is it possible for me to do that? |
44 | How signals work when Node2D is queue freed? Consider this setup KinematicBody2D (Player) Sprite (icon.png) VisibilityNotifier2D With Player.gd class name Player extends KinematicBody2D signal unvisible onready var visibility notifier VisibilityNotifier2D VisibilityNotifier2D func ready() gt void visibility notifier.connect( quot screen exited quot , self, quot on screen exited quot ) func on screen exited() gt void emit signal( quot unvisible quot ) Now I have a template Level.gd Node2D (Level) Player extends Node2D onready var player Player Player export var debug no enemy false export var debug no player true func ready() gt void player.connect( quot unvisible quot , self, quot reset level quot ) if debug no player player.queue free() func reset level() gt void print( quot reset quot ) get tree().reload current scene() The print statement proves that this setup make a kind of infinite loop of reset because the signal screen exited is still emited when the player is queue free. Is it expected? I am even more surprised with this modified version which produces the same thing func ready() gt void if debug no player player.queue free() player.connect( quot unvisible quot , self, quot reset level quot ) |
44 | Godot and getting files via HTTP So, I am wanting to use Godot to get a (binary) file using HTTP and then either save it or, even better, turn it into a Resource in memory that I can use. It'll be WAV files that I'm getting in return (trying to implement MaryTTS, which is running as a server on localhost). I had a look at the docs for HTTPRequest, but can't seem to get a working solution. I do HTTPRequest.request("http ...") when a keypress is made, and I have the on HTTPRequest request completed() function, but this never seems to be called. I tried with the function in the same Node as the request (as per the docs' example), and I also tried putting it as part of a script for the HTTPRequest Node. If I hit the triggering key fast enough, it gives an error ("HTTPRequest is processing a request"), but if I do it slower, it doesn't give that error, so it appears it is finishing. It just doesn't do anything when it finishes. HTTPRequest gives a return value of 0, which I assume means no error? (Or should this give me HTTP status codes?) Any idea what I'm doing wrong? Can HTTPRequest handle binary files? How do I get this working? (Any suggestions on a better way to implement MaryTTS are also welcome). |
44 | No AA support in Godot 3.1? I'm using Godot 3.1.1 and just realized that there is no available AA options. According to some post, Godot 2 supports FXAA, but some reason it's took out from 3. So I try to get FXAA for Godot 3.1, but couldn't find any. I don't want to publish my game without Anti Aliasing. Is there a way to apply FXAA in Godot 3.1.1 which using GLES3? |
44 | How signals work when Node2D is queue freed? Consider this setup KinematicBody2D (Player) Sprite (icon.png) VisibilityNotifier2D With Player.gd class name Player extends KinematicBody2D signal unvisible onready var visibility notifier VisibilityNotifier2D VisibilityNotifier2D func ready() gt void visibility notifier.connect( quot screen exited quot , self, quot on screen exited quot ) func on screen exited() gt void emit signal( quot unvisible quot ) Now I have a template Level.gd Node2D (Level) Player extends Node2D onready var player Player Player export var debug no enemy false export var debug no player true func ready() gt void player.connect( quot unvisible quot , self, quot reset level quot ) if debug no player player.queue free() func reset level() gt void print( quot reset quot ) get tree().reload current scene() The print statement proves that this setup make a kind of infinite loop of reset because the signal screen exited is still emited when the player is queue free. Is it expected? I am even more surprised with this modified version which produces the same thing func ready() gt void if debug no player player.queue free() player.connect( quot unvisible quot , self, quot reset level quot ) |
44 | How do I decrease the scale of an instanced node or scene? I'm trying to decrease size of instanced RigidBody2D scene, through code. With scale(), I'm trying to decrease the size of the image sprite that's attached to the RigidBody2D. The problem is, it's not working. No matter how much I try to scale down, the size of the blood drop circle remains the same. const blood druple scn preload("res Scenes blood.tscn") func spawnBlood() var newBlood Blood druple scn.instance() rotationAdd rotationAdd 30 if(switchBloodSize 0) set scale(Vector2(2,1)) This part is my problem print("blood size ", newBlood.get scale()) add child(newBlood) switchBloodSize 1 elif(switchBloodSize 1) newBlood.scale(Vector2(0.5,0.5)) This part is my problem print("Blood size ", newBlood.get scale()) add child(newBlood) switchBloodSize 0 newBlood.set pos(Vector2(100,100)) rotate(rotationAdd) As you can see, I have two different if conditions, each with a different scale() and size. Sadly, both remain the same size. The strange part is that it does display the scale values as been altered, yet the newBlood instance is not visually changing. Why is this? |
44 | on Tween tween completed not triggering I'm using this script to print out my text in a textbox one character at a time, and to do this I'm using a Tween. I have this set up so that when the Tween sends the tween completed signal, then the variable finished becomes true. But for whatever reason, the tween completed signal never gets sent. Does anyone see a reason that the signal wouldn't be sent? Thank you! extends Control var tempdialog 'Super Animal Racing is shaping up to be a great game!', 'Thomas is so good at programming omg!', 'Isn 't this so exciting?' var dialog index 0 var finished false var totalcharacters 0 func ready() load dialog() func process(delta) AnimatedSprite.visible finished print( quot visible quot , finished) if Input.is action just pressed( quot jump quot ) load dialog() func load dialog() if dialog index lt tempdialog.size() finished false RichTextLabel.bbcode text tempdialog dialog index RichTextLabel.percent visible 0 Tween.interpolate property( RichTextLabel, quot percent visible quot , 0, 1, 1, Tween.TRANS LINEAR, Tween.EASE IN OUT ) Tween.start() dialog index 1 func on Tween tween completed(object, key) print( quot tweentrigger quot ) finished true |
44 | Linux Mint Godot window when ran very small I am running my game on Linux Mint 20 Cinnamon. When I run my game I get a very small window that is about 1 pixel tall. This happens across all projects. I have tried uninstalling Godot and reinstalling it from the package manager. I have also tried the official launcher from their website. Updating through update manager does not help as well. I get the same issue using Godot 3.2.2 and 3.2.3 |
44 | How to make a 3D mesh invisible in Godot? Just like the title says i'm trying to make the mesh disappear after a set value reaches zero. Current code is trying to simply turn the entity invisible so that later i can implement a resurrect function. if Sname get node("Entity").get name() print("punched number 1") selected.health selected.health 10 if selected.health lt 0 selected.health 0 get node("Control Button").disabled true Entity.visable false Is it even possible to toggle that value or is there an easier way to do this? I dont want to use free queue() as that would interfere with other entitys. Thanks for the help in advance, im new to Godot so sorry if this ends up being a no brainer. |
44 | How do I use get action strength in Godot? I get the error Invalid call. Nonexistent function 'get action strength' in base 'InputDefault'. extends KinematicBody2D export (int) var speed 400 export (float) var rotation speed 10 var velocity Vector2() var rotation dir 0 var stance 0 func ready() Input.action set deadzone("left", 0.25) Input.action set deadzone("right", 0.25) Input.action set deadzone("up", 0.25) Input.action set deadzone("down", 0.25) static func angle to angle(from, to) return fposmod(to from PI, PI 2) PI func get input() var left joy axis h Input.get action strength("right") Input.get action strength("left") var left joy axis v Input.get action strength("up") Input.get action strength("down") rotation dir 0 velocity Vector2() if(Input.is action just pressed("stance")) if(stance 0) stance 1 else stance 0 if(stance 0) velocity Vector2() velocity Vector2(speed, 0) left joy axis h velocity Vector2(0, speed) left joy axis v if(angle to angle(rotation, velocity.angle()) gt 0) rotation dir 1 elif(angle to angle(rotation, velocity.angle()) lt 0) rotation dir 1 else rotation dir 0 elif(stance 1) rotation dir (Input.get joy axis(0,7) Input.get joy axis(0,6)) velocity Vector2() velocity Vector2(speed, 0).rotated(rotation PI 2) Input.get joy axis(0,0) velocity Vector2(speed, 0).rotated(rotation) Input.get joy axis(0,1) func physics process(delta) get input() rotation rotation dir rotation speed delta move and slide(velocity) |
44 | Why does the kinematic body move in opposite direction after I interpolate its movement, and how do I fix it? I have added some basic movement and some manual interpolation to a cube that is a kinematic body in Godot. extends KinematicBody var speed int 10 var slowdown buffer 0.2 var movement Vector3(0,0,0) func ready() pass func interpolate() if movement.x gt 0 movement.x slowdown buffer elif movement.x lt 0 movement.x slowdown buffer else movement.x 0.0 func physics process(delta) if Input.is action pressed( quot left quot ) movement.x speed elif Input.is action pressed( quot right quot ) movement.x speed else interpolate() move and slide(movement) The problem is that when I move the cube using A and D, after the cube stops after the interpolation, it starts moving in the opposite direction with a non increasing speed. How can I fix this? |
44 | How to have a tilted FNT font on Godot? Since FNT is a bitmap font I was thinking perhaps making the padding negative to the right and left side of the characters and rasterizing each glyph already skewed by an angle could make the font appear to be tilted. Does any one know whether FNT sports negative padding or whether Godot support some form of skewing that could accomplish that? Please take a look at the image to see what I'm describing |
44 | Difference between process(delta) and physics process(delta)? The documentation is pointing one main difference, this is the concept of being synced or not with the physics engine, so the delta parameter has more chance to be constant in physics process(delta) than in process(delta). But I am pretty sure that no one counts on that. And that everybody checks the value of delta in physics process(delta). So what are the different use cases of those two functions? |
44 | How do I remove the window border in Godot? I want to show my Godot engine game in a borderless window, but not fullscreen. I want to just have the game view visible on screen with no title bar or window chrome. |
44 | How to create bullet hole decals in Godot engine? How can you create decals such as bullet holes in Godot? Godot doesn't seem to have any native method of creating decals. I am trying to create decals so that bullet holes will be displayed properly on curved and angled surfaces and corners. I have tried a few plugins, but none of them worked, they all either had a texture stretching issue or they didn't work at all. For example, when I tried using the Screen Space Decals plugin (https godotengine.org asset library asset 241), it did draw decals when a texture wasn't provided (a simple black rectangle by default), but when I assigned the bullet hole texture to the decal property the bullet holes became invisible. What would be an ideal method of creating decals in Godot? |
44 | How do I access a variable from my code in Godot's editor? In Godot, I have a node with a variable that I often need to tweak for balancing purposes. It would be a lot easier to manage if I could modify it inside the editor instead of the code. How would I go about doing this? |
44 | What is the efficient way to sync TextureProgress with a Timer not in the UI? I want to use a TextureProgress which reflects the state of a Timer. I have tried to emit signals FROM the Node2D. process() which owns the Timer with emit signal( quot time left changed quot , timer.time left) TO the UI but it seems to make huge impact on performance. |
44 | How do I access a variable from my code in Godot's editor? In Godot, I have a node with a variable that I often need to tweak for balancing purposes. It would be a lot easier to manage if I could modify it inside the editor instead of the code. How would I go about doing this? |
44 | Why does this variable keep returning to its original value? In my 2D platformer game, I'm trying to create a button that, when the player or a box is on top of it, opens a door of the same color. Here is the code for the button extends StaticBody2D onready var is object on button false func on Green Button Area body entered(body) is object on button true print( quot button is down quot ) func on Green Button Area body exited(body) is object on button false print( quot button is up quot ) Code for the door extends StaticBody2D onready var is object on button Green Button.is object on button onready var door collision CollisionPolygon2D func process(delta) if is object on button door collision.set disabled(true) print( quot unlocked quot ) else door collision.set disabled(false) print( quot locked quot ) The button prints the right things at the right time, so I assume the button is working properly, but the door constantly stays (and prints) locked. How do I fix this? Edit After a bit of experimentation, I think that the problem is that is object on button keeps returning to whatever value its assigned at the start If I set it to true at the onready, it stays true. I do not know how to fix this, either. |
44 | Why does this variable keep returning to its original value? In my 2D platformer game, I'm trying to create a button that, when the player or a box is on top of it, opens a door of the same color. Here is the code for the button extends StaticBody2D onready var is object on button false func on Green Button Area body entered(body) is object on button true print( quot button is down quot ) func on Green Button Area body exited(body) is object on button false print( quot button is up quot ) Code for the door extends StaticBody2D onready var is object on button Green Button.is object on button onready var door collision CollisionPolygon2D func process(delta) if is object on button door collision.set disabled(true) print( quot unlocked quot ) else door collision.set disabled(false) print( quot locked quot ) The button prints the right things at the right time, so I assume the button is working properly, but the door constantly stays (and prints) locked. How do I fix this? Edit After a bit of experimentation, I think that the problem is that is object on button keeps returning to whatever value its assigned at the start If I set it to true at the onready, it stays true. I do not know how to fix this, either. |
44 | How to add an icon to a script registered as a class? While learning Godot, the tutorial dictates how to add an icon to a class. Tutorial You may add a comma and an optional path to an image to use as an icon. You will then find your new type in the Node or Resource creation dialog. Steps taken Added a 16x16 svg file to the resources named something.svg . Created a script with a path to that icon. Added a node of that kind. I don't see that icon? Not sure why. |
44 | on Tween tween completed not triggering I'm using this script to print out my text in a textbox one character at a time, and to do this I'm using a Tween. I have this set up so that when the Tween sends the tween completed signal, then the variable finished becomes true. But for whatever reason, the tween completed signal never gets sent. Does anyone see a reason that the signal wouldn't be sent? Thank you! extends Control var tempdialog 'Super Animal Racing is shaping up to be a great game!', 'Thomas is so good at programming omg!', 'Isn 't this so exciting?' var dialog index 0 var finished false var totalcharacters 0 func ready() load dialog() func process(delta) AnimatedSprite.visible finished print( quot visible quot , finished) if Input.is action just pressed( quot jump quot ) load dialog() func load dialog() if dialog index lt tempdialog.size() finished false RichTextLabel.bbcode text tempdialog dialog index RichTextLabel.percent visible 0 Tween.interpolate property( RichTextLabel, quot percent visible quot , 0, 1, 1, Tween.TRANS LINEAR, Tween.EASE IN OUT ) Tween.start() dialog index 1 func on Tween tween completed(object, key) print( quot tweentrigger quot ) finished true |
44 | How to change FPS when using a sprite sheet and AnimationPlayer? With AnimatedSprite it is easy to change FPS. Is there a convenient way to do that with AnimationPlayer? |
44 | Is it better to connect signals in source code or with the IDE feature? In Godot IDE, what are the advantages and the caveats of using the visual IDE to connect signals to listerners instead of doing this var state bool onready var countdown Timer Countdown func ready() gt void state true countdown.connect( quot end quot , self, quot toggle quot ) func toggle() gt void state not state |
44 | How to get a consistent behavior for a rigid body hooked platform? Consider this platform made of RigidBody2D and PinJoint2D objects PinJoint2D setup is Softness 0 Bias 0.9 When I set the mass of the platform with high value, the structure starts to shake like this Why is this happening and how to fix that? |