top | item 35301493

(no title)

michannne | 2 years ago

I'm currently working on a game despite not being very familiar with Unity. When I have some feature I need explained, or running into some bug in the game, I'd usually use Google and find some forum post that hopefully has a similar problem to mine and go from there. With GPT, I can just tell it the problem and get an answer, without scouring through multiple posts or having to constantly readjust my query. Yes, the information it produces might be incorrect, but I think the (time needed to verify the solution provided) is less than the (time needed to produce a search query that gets the articles you want * time needed to read each article and see if it helps me).

Here's an example regarding grounded characters sticking to walls:

prompt: Thanks! I added walls and ground to my game, as well as detection so that if the player touches the ground, they will be in a grounded state. However, when the touch the vertical face of the ground/wall, they stick to it. Can you tell me what I'm doing wrong?

response: It seems like the issue you're encountering is related to the physics and collision detection in your game. The player is likely detecting the wall as the ground, and it's causing the grounded state to be triggered when it shouldn't be. To fix this, you can modify your ground detection code to take the angle of the surface into account.

Here's a solution using the Physics.Raycast method:

Assuming you have a LayerMask called groundLayer for ground detection, make sure the ground and walls are assigned to the appropriate layers in the Unity Editor

[...further details on using angle detection on collision, as well as accurate sample code]

I can even ask it to give me the reference for the _Physics.Raycast_ method:

response: Certainly! Here's the official Unity documentation for Physics.Raycast:

[URL to official docs filtered out by HN]

Physics.Raycast - Unity Manual The Physics.Raycast method allows you to perform raycasts in your scene to detect collisions with 3D objects.

[...further information on how to use it, including an accurate code example pulled from the docs]

This just drastically reduces time-to-solution, especially when you consider you can lazily leave out information and still get a good response.

In short, I treat it as though each session is a fine-tuned search engine and get a lot of value from it, but it doesn't completely replace forums or Youtube videos, for one it can't argue with itself to provide conflicting but valid alternate solutions - I'd have to argue with it/ask it to produce those.

discuss

order

No comments yet.