#💻┃code-beginner

1 messages · Page 726 of 1

raw shore
#

the player

rich adder
#

nono use links

#

!code

radiant voidBOT
raw shore
#

oh sorry

rich adder
#

we don't need wall of texts here

raw shore
#

so how do I use !code

radiant voidBOT
rich adder
raw shore
#

Igot it

#

I got*

#

now the player

rich adder
#

why is it all commented out lol

raw shore
#

oh I saw //

#

and I thouth I need too

#

lol

rich adder
#

nah that was an example for snippets , very small blocks like 5-6 lines

raw shore
#

the player

rich adder
#

link the video as well as explaining what exactly is happening or not happening on your end

raw shore
#

I have a problem

#

I dont have obs to record

silver fern
#

unity has a recorder package

raw shore
#

how do I acces it ?

rich adder
#

thats cumbersome for just capturing

#

use something like Snip or whatever is called on windows

#

didnt they add a recorder now ?

silver fern
#

mine only does screenshots

rich adder
#

w11 i think they added

silver fern
#

ah I have w10

rich adder
#

if you have Nvidia you can also use nvidia capture

#

or windows + G you get the recorder

rich adder
raw shore
rich adder
raw shore
#

what do you mean

rich adder
#

did you remove a screenshot?

raw shore
#

yeah it was with 2 bugs but is old

#

the script is in animator

#

the event one

rich adder
#

alright then so whats supposed to happen again vs whats happening

raw shore
#

so you should be in idle and be anle to jump with 2 animation jump and fall but the player starts as a falling animation or jump based on where it was under map or up and you cant jump, also the animation is blocked

raw shore
#

yes

#

and it will take a lot to rewatch the tutorial to see the problem

rich adder
#

are the transitions setup correctly

raw shore
#

yes animation tree is correct

#

the window is good

#

animator

rich adder
#

did you check it during runtime and seeing what animator is doing while its not working

#

you have to select gameobject with animator running to see the transitions working / params moving

raw shore
#

so from idle/move goes to jump

rich adder
# raw shore

yes I mean observing this during runtime while the gameobject is selected so you can see what happens from Air to Ground again

raw shore
#

nothing its stuck

rich adder
#

yes but where..

#

thats whats important to know where it goes wrong

raw shore
rich adder
#

okay so the transition from Fall to Idle ain't workin?

#

what conditions are setup

silver fern
#

is the grounded check working right?

raw shore
#

it shouldnt even jumo

#

grounded should be ok

rich adder
#

should is not the same as verified

raw shore
rich adder
#

have you seen the animator variable goes back to isGrounded?

raw shore
#

no

rich adder
#

so you cannot make assumptions its working, at least not fully

rich adder
# raw shore

what conditions in the transition from Fall/Jump to Idle

raw shore
#

the problem is that the tutorial gets new scripts from 4 hour but a lot was made before so its hard to rewatch

#

isGrounded true

#

no exit time

silver fern
#

then check if isGrounded is actually true

rich adder
#

as mentioned, you look at the animator and see what happens when you fall from jump

raw shore
#

the Grounded is not checked

rich adder
#

then you never go into grounded

raw shore
rich adder
#

there ya go, that tells you where the issue is

silver fern
#

wait a minute

#

isGrounded = Physics2D.Raycast(transform.position, Vector2.down, groundCheckDistance, whatIsGround);

#

is that meant to be that way because raycast returns cast results

rich adder
#

it should.. afaik Raycast has implicit cast on the collider to bool

raw shore
#

yes Raycast is meant

silver fern
#

ok

#

make the raycast visible in the gizmos section

raw shore
silver fern
#

oh right, you have to draw a debug ray
Debug.DrawRay(position, direction * distance, Color.green);

rich adder
#

looks like it already has somewhat of an attempt

#

but its DrawLine

#

I dont see it tho

raw shore
#

idk why it should been

rich adder
silver fern
#

Gizmos.DrawLine(transform.position, transform.position + new Vector3(0, -groundCheckDistance));

#

isnt the vector missing a coordinate

rich adder
#

-groundCheckDist should in theory be the Vector2.down * dist

raw shore
silver fern
#

groundCheckDistance is declared as a float

rich adder
#

yea inside Vector3

rich adder
raw shore
#

so best thing is to rewatch a part of the video

#

😔

rich adder
#

usually something wrong you copied / missed something when following a video

raw shore
#

yeah

rich adder
#

those 1+ hours videos are the worst too

raw shore
#

happend a few times

#

its 6 hours

#

and I got to 4:28:00

rich adder
#

yiikes..its better watching those types of videos a couple of times before copying so you're kinda familiar with the process you will be doing

#

6hours is rough tho..too long man.. make the shit quick. get to the point lol

#

"Make Entire Minecraft in 7 hours"

raw shore
#

he has a server so maybe but a little maybe he will be able to help

#

he is a 8k followers youtuber

#

not indian lol

rich adder
#

sadly followers dont equate to quality

raw shore
#

I mean he made some cool stuff

#

he is Alexdev or smth like that

rich adder
#

showing a quick feature or alternative approach to a problem is one thing..making those entire long session of "make x game in 5 hrs" or whatever is poor quality

raw shore
#

yeah I show I will try more easier games

#

clicker

#

flappy bird

#

catch

rich adder
#

easier game + start with small building blocks to learn

#

you will be able to make your own thing in no time

#

do you know even 5 % of what your current code does? or what some functions do ?

raw shore
#

I learned a little C# from 12 hours video from CodeMonkey

#

I did C++ math

#

like Fibbonaci

#

bubble sort

#

so I know what things are quick

rich adder
#

okay so at least you know the familiar cs concepts

raw shore
#

yeah

rich adder
#

unity is an API . so once you are comfortable with reading any API type with C# knowledge you're set.

raw shore
#

thx

#

I will so small games

rich adder
#

the basics of unity concepts to know play into it too . What are gameobjects? components? lifecyle of them etc..

raw shore
#

and after that retry to make them

#

but with diff sprites

rich adder
#

yeah most people want to jump to their personal project / the next big thing right away but that usually leads to failure

raw shore
#

I like the b cart 3D videos but I am NOT ready for 3D lol

rich adder
#

unity is already 3D engine, the only 2D components you been working with are physics

raw shore
#

I was in some projects in Roblox same big idea and they failed

rich adder
#

well keep at it, you will get to your big idea soon enough

raw shore
#

Unreal is good on 3D but I dont like how it looks

#

its like a kidder version then Godot

rich adder
raw shore
#

yeah the UI is weird

#

of buttons

#

can you give me some ideas for 2D games to make ?

#

like other then clicker

#

or flappy bird

#

or catch thing

silver fern
#

2d factory game

rich adder
#

the usual ones like you mentioned. A lot of those old school games, you know atari era

#

things where you can make a quick gameloop

rich adder
raw shore
#

yeah maybe I should go to GMTK 2025 games

#

the theme was loop

#

soo what I need a simple game

raw shore
silver fern
#

fair

#

make uno

rich adder
#

angry bird, flappy bird, simple platformer, breakout, any inifinte runner

raw shore
#

what is breakout ?

rich adder
raw shore
#

oh yeah

#

Physcs

rich adder
#

those can be fun you can put your own spin to it once the initial game loop is done. Bonuses etc

raw shore
#

and bouncy

#

yeah

#

Itch has good games in game jams other then that only horror

#

and they are the same

#

a night at a shop place

#

lol

rich adder
#

lol I have an old project i was cleaning up and its quickie mart store owner sim lol occasionally you get robbed or ported into another world

raw shore
#

cool

rich adder
#

but ya it has become a tired genre since so meh

raw shore
#

Itch should be the place for cool indie games but you can see only 20 that are popular

#

you need to dig for cool games

silver fern
#

shame desura shut down

raw shore
#

nav

#

you have youtube ?

rich adder
raw shore
#

oh yeah

silver fern
#

how do I debug collider collisions?

polar acorn
slow blaze
#

So this collider is set OnTrigger and while calling
OnTriggerEnter2D(){
}
I get no response back

#

(The checkmark is the player, does have a collider too)

silver fern
rich adder
#

and which one has rigidbody2d

slow blaze
slow blaze
polar acorn
rich adder
polar acorn
#

3D rigidbodies call 3D collision events on 3D colliders

slow blaze
#

I'll try again holon

rich adder
#

im sure it wouldnt let you

slow blaze
#

I might have lapsed my judgement

#

I indeed tried to put 3d colliders thinking they were 2d lmao

stuck current
#

Is there anyway to play in the insect or with a Mac

#

For vr

rich adder
#

yeah you prob want 2D then lol 3D colliders / rigidbody not work with OnTrigger2D

slow blaze
#

OnTrigger without 2D trollemoji

polar acorn
rich adder
#

whats "in the insect"

stuck current
# rich adder wat?

Meta dosent have a Mac version for their desktop app so you can’t link your headset I’m asking if there’s any alternative ways

rich adder
stuck current
rich adder
polar acorn
rich adder
#

ah ok

polar acorn
#

By which they probably actually meant "Editor"

#

But if your headset just isn't compatible with your OS, you aren't going to get far. You should consider getting an actual computer instead of a computer-shaped cellphone.

rich adder
#

or just run it in VM with parallels or fusion

#

whenever i need spydos I use that

grand snow
#

I presume this app exists for desktop vr and windows is the major platform for this
mac desktop gaming is dead or half dead and well linux is a second thought only some consider

subtle bronze
#

ive only just started with unity, how come a public inputsystem doesnt show up in the editor for the script its in and then whines that not even enable is a real function?

grand snow
#

perhaps share some code? !code

#

bot ded

subtle bronze
# grand snow perhaps share some code? !code
using UnityEngine.InputSystem; // required

public class NewPlayerController : MonoBehaviour
{

    public InputAction playerControlsNew;
    void OnEnable()
    {
        playerControlsNew.enable();
    }
subtle bronze
#

what a pain in my ass this whole engine is, thank you for helping me

rich adder
grand snow
#

!ide

radiant voidBOT
grand snow
#

@subtle bronze ^ ensure its configured properly using the above

rich adder
grand snow
silver fern
#

it's detecting a ground collision here but ground is only the white stuff at the bottom

rich adder
silver fern
rich adder
#

is it set to ignore self / player and all that?

silver fern
#

yes but why does it detect ground collision

rich adder
#

are you talking about the green line on the character?

silver fern
rich adder
#

the function returns collider so print name of what is capturing

silver fern
#

they're not even close

#

they're obviously not touching

rich adder
#

are you passing in the correct collider ?

silver fern
#

bulletCollider = GetComponent<PolygonCollider2D>();in Start()

rich adder
silver fern
#

being the background and player

rich adder
#

is this thing a moving object ?

rich adder
silver fern
silver fern
rich adder
#

its not parented to mouse or anything

silver fern
#

the collider?

rich adder
#

yea

#

checks collision and disappears, but stays stationary

#

like rotation with mouse or any of that

silver fern
#

it goes in the direction of the mouse yeah but it shouldn't be parented

#

it just gets a direction vector

rich adder
#

its like an instantiated object ?

silver fern
#

yep, its instantiated in the attack script, but it appears in the scene hierarchy on the top level so I don't think it's parented to it in any way

#

I certainly didn't parent it explicitly

languid pagoda
main grove
#

Hi sorry can i ask questions about game here?

silver fern
main grove
#

yes

#

i need an help for a meccanics

languid pagoda
main grove
#

I’m making a 3D Unity game. It’s not my first, but I’m not very good yet, so I’m asking for help from more experienced people.

I want a “magnet” mechanic: the player has a sphere collider around them that detects objects (by tag or script). If they’re inside, the player attracts them. If I click the left mouse button, the effect inverts and the player repels them, like a real magnet.

I already made a script for attraction/repulsion (pasted at the end), but the result isn’t what I expected. I’d love some guidance — not full code from scratch, but maybe how to structure functions, or a simple customizable tutorial so I can learn for the future.

My idea:

Objects inside the trigger collider are attracted.

Left click repels them with opposite force.

Close to the player, they should orbit or stop on contact with a smaller inner collider, so they don’t push into the player or cause bugs (like flying away).

Maybe later I’ll add object switching or animations, but that’s secondary.

This is my concept. Any help would be greatly appreciated.

SCRIPT:
Attached file.

#

this

#

is big i know

silver fern
languid pagoda
silver fern
languid pagoda
silver fern
#

I suppose you gotta decrese the lifetime again then

languid pagoda
#

10 seconds is about how long it takes for the smoke from burning out takes

#

is there like a setting for a natural dispersion?

silver fern
#

look at velocity over lifetime

rocky canyon
#

that way ur Lifetime of the particle has the time it needs to last for 10 sec

#

then for dispersion it a combo of color over lifetime -> alpha 0
size over lifetime -> towards zero etc

#

yea theres alot there to unpack.. but its not too bad (theres only a few that really matter all that much)

#

if ur doing it as a burnout u probably wouldnt need to be looping..

languid pagoda
#

like i can click it but the curve editor doesn't pop up

rocky canyon
#

u can modify it right in the graph

languid pagoda
#

lol thanks

rocky canyon
#

click this and drag it upwards

languid pagoda
#

had it scrolle ddown

rocky canyon
#

yup yup 👍

languid pagoda
#

appreciate it!

rocky canyon
#

np, and it just takes fiddling with it to learn.. you kinda get the hang of it as u work with it

#

for me the duration was the most confusing.. b/c u have the main duration.. and u have the start lifetime
which is a little different

#

but just for a simple example..
think of it like this
if ur Main Duration is 10
and you have it set to Loop
and ur particle Lifetime is 5..
then (2) sets of particles would exist within that (10) second timeframe

languid pagoda
#

im going to give those videos a watch

rocky canyon
#

ya, i wouldnt make it like that.. but it kinda shows the difference

#

if u set ur start lifetime to 10.. it wouldnt make sense for ur main duration to be anything less

#

thats kinda the point i was trying to make

#

mine are ususally the same...

rocky canyon
# main grove I’m making a 3D Unity game. It’s not my first, but I’m not very good yet, so I’m...

for a stable magnet mechaic i'd keep the player responsible only for detecting and applying forces
and let hte objects just be "magnetizable" rigidbodies.. use a normalized direction vector and scale that force by distance (clamped so its not too week far away or explosive up close).. switching between attraction and repulsion would be as simple as just inverting the force when input is pressed (-force)

to stop objects from clipping into the player you could add a smaller inner trigger zone where you either zero out their velocity once they enter... to make them stick or.. add a sideways force so they orbit..

handle all the phyics in FixedUpdate() and give the objects some drag so they dont fling uncontrollably.. start simple and work ur way up to the full mechanic

if it were me i'd just start with attraction.. get all the behaviour worked out.. (like the clipping and all that crap)
then it'd be easy enough to refactor it to add repulsion as well.. then if u wanna go all out u could use falloff Curves to refine how exactly it would feel..

#

what exactly does the mechanic do?
like whats the purpose of this mechanic? it might clear up some things

#

instead of Stay()
i'd use Enter and Exit

    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Magnetizable"))
        {
            Rigidbody rb = other.attachedRigidbody;
            if (rb != null && !magnetizedObjects.Contains(rb))
                magnetizedObjects.Add(rb);
        }
    }

    void OnTriggerExit(Collider other)
    {
        Rigidbody rb = other.attachedRigidbody;
        if (rb != null) magnetizedObjects.Remove(rb);
    }``` and I'd have a "Collection" of these objects
in the rest of the code you could loop thru the list applying the logic to each one
#

i rememeber not too long ago i did a 2D black-hole mechanic.. and i believe thats how i did it as well..
just adding the objects to a List<> and removing them once they exited

chilly vigil
rich adder
chilly vigil
rich adder
main grove
chilly vigil
rich adder
#

you just have to drag the text you want to change into it

#

the gameobject that holds it works too

chilly vigil
#

code monkey alway says thst you should use [serlizeField] for string intead of find()

rich adder
#

its often better to link it through the inspector, sure

rocky canyon
#

the correlation is bad tho..

  1. you shouldn't ever want to use Find() for anything unless you need to..
  2. you should assign mostly everything you can in the inspector when possible edit: until you get familiar with coding.. then you can assign things via code to exclude that step too, assigning things in the inspector makes it easier to change those things
  3. to do step 2 you should always lean on using [SerializeField] private rather than a public field
    3a. public fields are for fields you wan't to access publicly from elsewhere (other scripts)
#

also.. might wanna tighten up on your keyboard control as well..
coding is gonna be a bad time for you if you make typical spelling and grammar mistakes

rich adder
#

3a I'd prefer a Method or Property over a public field ever, much better options too
gives you flexibility to invoke react to change or run some logic

rocky canyon
#

also very true

rich adder
languid pagoda
rich adder
#

writing code isnt even the main issue

languid pagoda
#

whats the issue?

#

i use it to write code I can probably write myself but cant be bothered doing

#

ie the graph

crimson fable
#

so, im new here, and i have a problem

rich adder
languid pagoda
rich adder
#

if it works for you good, but we dont encourage it around here

#

especially beginners

languid pagoda
#

to say it doesn't have use is ignorant though

#

its a tool no different than visual studio or unity

slender nymph
crimson fable
#

for the experienced, its super simple

but im working on a thirdpersongame and i nailed idle and running animations, but i have no idea wtf im doing, and for the life of me i cant get jumping/in air animations

ive tried many resources, and i cant get it to work

slender nymph
#

show relevant code

crimson fable
rich adder
radiant voidBOT
slender nymph
alpine crystal
#

Bro can anyone help me

rich adder
#

also dont crosspost

alpine crystal
#

Oh I might have been doing that because I've been needing help so bad

#

@rich adder

frosty hound
rich adder
#

if you needed help so urgently you'd actually ask the question in detail

alpine crystal
#

#💻┃unity-talk for some reason it's blocked for this when you try to say help me please

frosty hound
#

A simple question you have refused to ask for some odd reason.

rich adder
#

lol true you been blabbin everything but the question

alpine crystal
frosty hound
#

What is your question?

alpine crystal
# frosty hound What is your question?

So I made something on blender and I've been trying to figure out how to paste it in until unity project and I've been trying to switch for so many tutorials and nothing helps because it's so old

rich adder
#

export to fbx -> drag into unity. done

frosty hound
#

First of all, not a coding question.

Secondly, export it as an FBX and drag it into Unity.

alpine crystal
#

Okay cuz I might even use it differently but I couldn't find where I can ask the question the general doesn't allow you to say what I need which is stupid but yeah I guess I can go back and replace it and then do it again I'll grab my PC but thank you

rich adder
rich adder
#

next time open up with a question to your problem giving all the context and details in one message, no need to spam multiple "help" sentences, it does nobody any good just delays the help process..

alpine crystal
#

Ok now could you explained export it as an FBX and drag it into Unity. Like how do you fully do that cuz I'm going on unity right now to my project

rich adder
alpine crystal
rich adder
alpine crystal
#

Okay but for the AI probably when you give me a full example

#

@rich adder

rich adder
subtle bronze
#

why does the capsule collider from a character controller module make the object slowly sink into the floor? also why does .Move choke up with 3 arguments when its a vector3? do people even use this garbage script? horrible to work with

rich adder
subtle bronze
#

no i mean the one that it makes

rich adder
#

then idk what you mean slowly sink into floor. there shouldn't be anything sinking it unless you coded something wrong

subtle bronze
#

i figured it out, i tried setting up a rigidbody for the player bc i didnt think a character controller natively had movement

upper tendonBOT
#

That command does not exist. Use =help to see all the commands.

worn bay
#

Why don't these add up, like where did the remaining 7.35ms came from?

north kiln
#

TryGetValue itself

worn bay
#

oh :v

lilac wave
#

I really need hell wkth a game im making!

gentle bone
#

!learn

radiant voidBOT
lilac wave
#

Please I would greatly appreciate help! I have the whole game premise and stuff in there if you wanna help!

#

!learn

radiant voidBOT
gentle bone
gentle bone
#

yes..

lilac wave
#

Okay..

#

Man it's 3:32AM😭

lilac wave
gentle bone
#

just a habit.. from IRC times^^

lilac wave
#

Oh okau

lilac wave
gentle bone
#

just check the learn site with the ghost haunt game...

#

as ive read you try doing some stealth game reaching from point a to b.. with guards etc..

lilac wave
gentle bone
#

thats mostly what the ghost game is..

lilac wave
#

Now that I think of it, it was more like 2 years ago

lilac wave
gentle bone
#

just check the site.. its a complete tutorial with codes etc..

lilac wave
#

I did I don't know what im looking at lol cuz my browser his bananas when I use my phone for no reason

gentle bone
#

then check out on a desktop environment..

lilac wave
#

I can't it's 4:00AM

gentle bone
#

then do it later^^..

lilac wave
gentle bone
#

im not here to do your coding... i gave you a hint for what you search...

near wadi
fading barn
#

Is their some way that I make a new class that is inherited from a class that also is a component and the new class can also be a component. Can classes that inherit from class other than monobehaviour be used as components

naive pawn
#

that's the point of inheritance

#

MonoBehaviour isn't even Component

#

Component is Component, and stuff extending MonoBehaviour are also components because they inherit Component

fading barn
#

So a class named component exist and monobehaviour and components (like rigidbody or collider) inherit from component class?

naive pawn
#

yes

worn bay
# north kiln TryGetValue itself

How do I know where did the rest of the time ms came from? I know it came from the method call itself, but I wanna know the specific intensive part within it if possible :')

#

(this is also in deep profiling)

keen dew
#

What's visible there adds up to 41 ms (and probably more in the part that's not shown) so in this case the cause is the sum of multiple small things instead of one big thing

worn bay
grand snow
#

id make sure those optional things are enabled and then check again

grand snow
#

I think its in the call stacks dropdown button, someone correct me if wrong

teal viper
# worn bay the one on the side?

You need to expand it more. There's something pretty heavy happening on your object getting activated and you're activating a lot of them too.

teal viper
# worn bay

What kind of objects are you activating? What components do they have?

#

Also, because of the cropped screenshots, it's not clear, but do you have deep profiling enabled?

worn bay
teal viper
#

OK.
Another thing is that 900ms are coming from the editor, so might want to profile a build instead.

#

Or profile in the editor mode if you want to debug it.

worn bay
#

Have been thinking about pooling the hitobjects but it's too tangled to do it atm

teal viper
grand snow
worn bay
#

Overlooked the build settings

grand snow
#

il2cpp may change perf a bit too but this should result in cleaner profiling

worn bay
grand snow
#

well no because if you plan to use il2cpp for prod then why profile with mono?

#

i wouldnt change it and i presume a built wont take more than 20 mins anyway

worn bay
#

ah crud it doesn't take mouse input

#

How do I simulate a touch input on a build?

#

@grand snow if you don't mind

grand snow
# worn bay <@123135850560225282> if you don't mind

Is this for mobile? If using input system you can have mouse input on your actions too or you need to add support for mouse explicitly for desktop.
Old input system makes touch work like mouse input but Input.touches is ofc only touch.

teal viper
worn bay
#

Yeah we're using the new one

grand snow
# worn bay Yeah we're using the new one

profiling does work on mobile dev builds. android can be done over the network and usb, ios I think is network only.
Try adding mouse input to your actions if using them instead of enhanced touch.

worn bay
#

(I've never done mobile debugging before)

teal viper
#

At least, if you're serious about releasing the game on that platform.

grand snow
#

mobile builds (especially with il2cpp) arent that fast

#

but to profile accurately its the only way

worn bay
#

I don't mind waiting, it's just the cumbersome work to update the changes on the target device

teal viper
#

If you built once already, a lot of stuff should be reused from the cache. Especially around assets and shader compilation, that is usually what's taking most of the time.

grand snow
#

yea and with android build and run will install the app for you via adb and then open it

worn bay
grand snow
#

you have to rebuild and update your app each time but it should build faster when little has changed

jade elm
#

where can i find a developer or programmer, i want to commission for ai chatbot using 3d model in unity

grand snow
#

!collab

radiant voidBOT
# grand snow !collab

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
• ** Collaboration & Jobs**

grand snow
#

not here buddy

ashen girder
#

Couldn't create 'C:\Program Files\Unity 6000.0.54f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.modules.unityanalytics/~UnityDirMonSyncFile~e0dd5c6f5e53c6a4bac68e47894e86c2~'

I knoy this is a common error but is there a FAQ for how to solve it ? (i downloaded unity from the archive rather than unity hub)

I also tried to set the editor folder to full control

raw sonnet
#

hey everyone! can someone please help me fix a scipt?

naive pawn
#

!ask

radiant voidBOT
# naive pawn !ask

:thinking: Asking Questions

:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.

-# For more posting guidelines, go to #🌱┃start-here

naive pawn
#

@raw sonnet we can't help without info about your issue 😉

tidal shuttle
raw sonnet
naive pawn
#

we can't help without that info lol

#

see below for posting code properly

#

!code

radiant voidBOT
tidal shuttle
naive pawn
#

then it's "viable", yes

tidal shuttle
#

alright thank you

worn bay
teal viper
worn bay
#

this is definitely not adding up

teal viper
#

It does. Self time means that it's the code inside the method itself that is taking all the time. Not one of the children in the profiler

#

I'd suggest putting several profiler markers in your UpdateMesh method to see what parts of it are heavy.

grand snow
#

Good god yea 2 seconds is bad.
Markers will help increase the detail of this data

#

You can also use stopwatch to time async things

worn bay
grand snow
slow blaze
#

Application.persistentDataPath how can I send this data on github?, also is it kept on build?

tall heart
#

did anybody learn by making games with unity tutroials

silver fern
#

yeah

warm magnet
#

following code monkey course, can someone explain why this doesnt work?

strong wren
silver fern
hexed terrace
#

That's (probably going to be) a property - they've just missed a symbol

silver fern
#

I noticed something weird about my projectile collider. When it's pointed to the right, it detects collision with the white ground object, and when it's pointed to the left it does not, regardless of it actually touching the ground or not. Anyone have any ideas why it would do that?

#

this thing is driving me crazy

#

I tried Collider2D.Overlap, Physics2D.OverlapCollider and PhysicsScene2d.OverlapCollider and they all give me the same results

silver maple
#

Trying to make vs recognize the movement crap. ( ie :MonoBehaviour) It's not having it. Any advice

grand snow
# silver maple

update visual studio editor package in your project
make sure unity has visual studio set to the external editor

#

otherwise follow the !ide guides

#

!ide

radiant voidBOT
silver fern
#

or does anyone have any ideas on how to debug the collisions beyond printing out the colliding object names?

#

or do I have to write my own collision logic somehow

grand snow
#

the unity physics debugger will help you out and may be better incase you are using the gizmos incorrectly

silver fern
#

thanks I'll have a look at that

#

is meshcollider the same as polygoncollider?

#

because it doesn't have an option for polygon colliders

grand snow
#

Ah poo it may be for 3d physics only

#

are you using vertx rn?

silver fern
#

yeah

grand snow
#

That should be pretty good but if you are getting colissions that dont make sense then you probably did something wrong
more likely your gizmo is wrong than physics 2d

#

You can try things like using Debug.Break() to pause the game when a collision happens so you can check what state things are in

silver fern
#

gizmo being the collider?

#

using break here right as the collisions are detected, and everything looks the way it should be, but it's still detecting the ground collision when pointed to the right side

#

the purple box is what vertx is showing me, so the colliders are definitely in the right location afaict

grand snow
#

both cant be true can they?

#

how can it collide if its not anywhere close?

silver fern
grand snow
#

do what i suggeted use Debug.Break() to pause the game when this bad collision happens so you can check the game state

silver fern
ashen girder
#

Is the 3d mobile template good if i wanted to make something for android ? Or is 3d universal still the best

silver fern
#

except for that collision

grand snow
grand snow
ashen girder
#

Alright thanks

silver fern
#

how is this even possible

grand snow
#

i wonder if its how you move the object when you look left/right

silver fern
#

it doesn't actually move, it gets instantiated with a rotation, checks collisions once, and then disappears

#

wait a minute, is it possible that it checks collision before rotation

grand snow
#

hmm yea that sounds a bit sus

silver fern
#

bullet = Instantiate(ultimateAttackPrefab, projectileSpawnerTransform.position, gunHandTransform.rotation); but it's instantiated with the rotation so that shouldn't happen right

grand snow
#

do you change its parent or anything like that after?

silver fern
#

no not at all

silver fern
#

I just realized something weird

#

if i put Debug.Break(); in the line before instantiate, it will still show the projectile on the break

#

shouldnt it stop before that?

#

I think I just saw the projectile very briefly appear in a wrong rotation before correcting itself for like 1 frame and I'm trying to capture that but no luck

#

is there any way to make sure the rotation happens before anything else?

naive pawn
silver fern
#

I fixed it in a really stupid way

#

instead of applying rotation in code I edited the sprite to be pre rotated and now it works

#

thanks for help rob

west sonnet
#

Is using "Resources.Load<GameObject>("PathToPrefab")" bad game design?

silver fern
#

for some reason, it checked collision before rotation even when I apply a rotation in Awake()

silver fern
#

I'd say that line by itself is not game design

naive pawn
#

it's probably a bad practice but it's unrelated to gamedesign, yeah

#

more about architecture

#

if it's a constant string, just.. use a serialized reference, this is arguably more work

rich adder
silver fern
rich adder
patent wedge
#

LerpAngle's values aren't in 360 range?

Vector2 Vel = (LastMousePos - UIMousemove.action.ReadValue<Vector2>()) * Time.deltaTime;

bool moving = UIMousemove.action.ReadValue<Vector2>() != LastMousePos;
float angle = Mathf.Atan2(Vel.x, -Vel.y) * Mathf.Rad2Deg;

var AngleSpeed = moving ? (MovingSpeed * Vel.sqrMagnitude) : StillSpeed;
currentAngle = Mathf.LerpAngle(currentAngle, moving ? angle : 45, Time.deltaTime * AngleSpeed);

Quaternion val = Quaternion.Euler(new Vector3(0, 0, currentAngle));

transform.rotation = val;
``` i've debugged angle and that appears to be in 360 range but not LerpAngle? (ps should velocity be divided or multipied by deltaTime)
silver fern
#

multiplied

silver fern
patent wedge
cunning bramble
#

Yo guys i need help so i have an plant and i want so see it from an diff ancle so i made an script and wenn i press E it gets me there but i want it so that it only works if i am near by any ideas?

https://paste.mod.gg/ilmodtoatesm/0

patent wedge
cunning bramble
#

overlap?

silver fern
rich adder
patent wedge
silver fern
patent wedge
silver fern
#

after multiplication

patent wedge
silver fern
#

0 is the start point, 1 the end point

subtle bronze
#

how am i intended to transform another game object? my code looks something like this and it says object reference not set to instance of an object

    void Awake()
    {
        GameObject playerCamera = GameObject.Find("PlayerCam");
    }
    void Update()
    {
        playerCamera.transform.Rotate(0, 0, lookInput.y * mouseSens, Space.World);
    }```
patent wedge
rich adder
silver fern
subtle bronze
silver fern
rich adder
#

you have to distinguish between Local variables and Fields, need to refresh on c# basics

grand snow
#

and what is f_addLine(), a member func or a delegate?

rich adder
#

@subtle bronze

void Awake(){
int myNumber = 3;}

void Method(){
myNumber = 2; // error because myNumber only exists in Awake
}```
worn bay
# grand snow and what is f_addLine(), a member func or a delegate?

a method to push vertices data into a list (inefficient, I know)

void f_addLine(Vector3 start, Vector3 end)
{
    // No AddRange here because the alloc overhead adds up
    _Verts.Add(start);
    _Verts.Add(end);

    if (_Verts.Count > 2)
    {
        _Tris.Add(_Verts.Count - 4);
        _Tris.Add(_Verts.Count - 2);
        _Tris.Add(_Verts.Count - 3);
        _Tris.Add(_Verts.Count - 2);
        _Tris.Add(_Verts.Count - 1);
        _Tris.Add(_Verts.Count - 3);
    }
}

-# disclaimer I didn't wrote this so idk the numbers here

rich adder
grand snow
cunning bramble
#

@rich adder thank you got it but now is there an problem so my player is blocking the view and i cant deaktivate him bc the camera is at the player so what could i do guys?

subtle bronze
silver fern
worn bay
cunning bramble
#

i dont understand wdym? @silver fern

rich adder
silver fern
cunning bramble
#

Wait i show you

naive pawn
rich adder
cunning bramble
#

Thats what i mean

silver fern
rich adder
#

ok so what do you want to do..
Hide the player or change the angle

cunning bramble
#

Hide the player

#

But if i deaktive him the cam getts shut down 🙁

rich adder
#

then you just reference the mesh component and disable it

#

no need to shut down entire gameobject for just visuals..

cunning bramble
#

okay let me try it out

rich adder
#

[SerializeField] Renderer r
r.enabled = isPlayerVisisble

cunning bramble
#

Okay

#

So i made this but the codilor is still active but i think i deactivated it 🙁

silver fern
#

whats the issue with the collider

cunning bramble
#

i cant click trouhg

rocky canyon
#

u can really easily check the inspector and see if its enabled or not during playmode

cunning bramble
#

Wait i am showing you

#

oh yes true

rocky canyon
#

enabled < > disabled

rich adder
#

btw why are these MBs instead of just their component/script name
public MonoBehaviour cameraScript;

rocky canyon
#

should correspond to ur debug too..

cunning bramble
#

guyss

rocky canyon
cunning bramble
rocky canyon
#

shame on me.. lol

cunning bramble
#

Yes so the capsule colider gets deactivaded

#

but i cant click trough

rich adder
#

ohh.. but if they're all MBs/components they should still have .enable no ? or is the list for like a "generic" @rocky canyon

rocky canyon
#

then its most likely some other issue besides that collider

naive pawn
silver fern
cunning bramble
#

oh okay let me change it

rocky canyon
#

dont know their excuse tho

rich adder
#

gotcha

rocky canyon
#

for a single script... i wouldnt see why u wouldnt use the class type

#

just for clarity

naive pawn
cunning bramble
#

Urrmmm i cant keep up so what are my options now? xD

rocky canyon
#

👀 👓 CLARITY

rocky canyon
rich adder
rocky canyon
#

thats where we at

cunning bramble
rocky canyon
rocky canyon
#

like the setup...

#

what are u trying to click thru..

#

and how

cunning bramble
#

trouhg the charackter aka PLAYER

#

To farm the Crops from the plant

rocky canyon
#

yea but how u clicking? is it a raycast? are u using the eventsystem?

#

ahh its a raycast i see now

#

debug the hit of the raycast and see whats blocking it

cunning bramble
#

okay let me add it

rocky canyon
topaz elbow
#

hii

rocky canyon
#

nav.. ur up

rich adder
silver fern
rocky canyon
#

thats a good ^ workaround

#

exclude ur player permanently

cunning bramble
#

So i click the player

#

so i need to do make the player ignore?

silver fern
#

yea

topaz elbow
#

yo gng, ive always been putting off learning c# because im scared that theres a massive difference if i watch a tut that uses smth like v2022, and im using unity 6 (v6000). is there acc a big diff in the coding part or am i just dumb?

cunning bramble
#

is there an easy way to do that?

silver fern
topaz elbow
fading barn
topaz elbow
#

damn, ive been putting it off since june

cunning bramble
#

So i deactivate the player layer

topaz elbow
#

waiting for a unity 6 tut

#

😔

#

alr cool, ty. gl to yall

silver fern
radiant voidBOT
topaz elbow
#

huh

#

wait what

topaz elbow
# silver fern !learn

I JS WATCHED AN HOUR OF THIS "CODEMONKEY" TUT, THIS IS WAY COOLER! (i understood barely anything)

#

tyyy

rocky canyon
#

codemonkey is more on the beginner -> novice side of things

topaz elbow
rocky canyon
#

unity's learn

topaz elbow
#

codemonkey or !learn

#

kk

topaz elbow
#

and if i only wanna learn 3d, should i still watch the 2d section or is it not important?

rocky canyon
#

this is my suggestion

cunning bramble
#

okay i dont understand nothing anymore bro like what do i need to do @rich adder @silver fern @rocky canyon

rocky canyon
#

2d and 3d work the same in terms of coding... u just use different components..

rocky canyon
topaz elbow
#

real

rocky canyon
#

plug that into the Raycast using the overload that takes the layermask

topaz elbow
rocky canyon
#

put the player on a layer called Player or something. and exclude that from the layermask

topaz elbow
#

its more reassuring knowing that it cant have any mistakes

#

idk why

cunning bramble
#

I dont get it @rocky canyon

silver fern
cunning bramble
#

I got it guys @silver fern @rich adder @rocky canyon i really appricate it I THANK YOU ❤️

topaz elbow
#

wait how do i reopen this gng

#

it aint here

rocky canyon
#

if its the correct project should be in this little Readme thing

#

or Tutorial folder check that

silver maple
#

Trying to make vs recognize the movement crap. ( ie :MonoBehaviour) It's not having it. Any advice
Have already updated visual studio editor package, set vs to the external editor in unity, and followed the ide guides but still got the issue

grand snow
#

!ide

radiant voidBOT
silver maple
#

ye I've followed all of that but not managed to get it going

silver fern
#

does serialize field actually prevent overwriting a value in code

grand snow
#

no

#

its just saved to the scene/prefab and applied on load
after that you can do what you want to it, but only AFTER Awake (well when Awake is executed its safe)

silver fern
#

this is really weird, I'm trying to change the value of a speed variable via a method but it keeps changing back to its original value when moving

silver maple
#

Trying to make vs recognize the movement crap. ( ie :MonoBehaviour) It's not having it. Any advice
Have already updated visual studio editor package, set vs to the external editor in unity, and followed the ide guides but still got the issue

Have already configured as per the guide

grand snow
silver fern
#

ohh

silver maple
#

I have done what the guide says to do, but yes that still claims to be compatable

grand snow
#

go to edit > preferences, make sure visual studio is the editor selected and THEN press "regenerate solution"

#

remember that vs code is not the same as visual studio

silver fern
#

thanks rob

silver maple
grand snow
#

is your vs updated and has the unity tools feature added? Check in visual studio installer

silver maple
#

yep have both installed

topaz elbow
silver maple
grand snow
#

time to delete all sln and .csproj files in your project and try again

silver maple
grand snow
#

yea it will re make them for you

hot wadi
#

Do u use abstract class or interface for state machines?

topaz elbow
silver maple
tall heart
#

After how many small games do you guys learn how to make a game without any help mostly

rocky canyon
#

Step 3.. <--- launching the project

#

it 💯 is there..

#

both ways work... extracting the zip download from the website..
or launching it thru the hub 👇

main grove
slender nymph
#

!collab

radiant voidBOT
# slender nymph !collab

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
• ** Collaboration & Jobs**

rocky canyon
rocky canyon
random lodge
hexed terrace
#

probaly with your project, not Unity

random lodge
#

All I did is remove a script and add an empty one

#

Restarted, did the same thing, same error

hexed terrace
#

If that prefab had the script you removed in it, then "all you did" was break your project

random lodge
#

How is removing a script from a prefab breaking the project

#

If that's so that's bad

#

They are made to change

hexed terrace
random lodge
#

Yea I removed the prefab script that was an empty script and re-created a new empty one

hexed terrace
#

Read the full console, rather than that tiny bit at the bottom

random lodge
#

And that error comes up every time

#

Complains about no monobehavior but it's there

hexed terrace
random lodge
#

from the prefab

hexed terrace
#

Ok, show a screenshot of the full console error

random lodge
hexed terrace
random lodge
#

Ah, weird that it throws an error after it creates the script itself

hexed terrace
#

Compilation can sometimes not finish or whatever, the fix is usually just to force another recompile

chilly vigil
ivory bobcat
# chilly vigil

Is this code related? Is it something to do with code you've written? What's in the project? You need to provide more context.

random lodge
#

If the animation of a sprite is larger than the sprite prefab that animates what would be the best way to have the animation sprites set to the same size as the prefab sprite? (animation results in it "expanding" size since they are different).

#

Guess I can pickup the prefab size and use it to resize the animation before playing in entry or so

chilly vigil
# ivory bobcat Is this code related? Is it something to do with code you've written? What's in ...

yes, it is i Added a C# to HighscoreTable (Game object) with same name.
Drag in the highscoreEntryContainer , highscoreEntryTranforms and then the following (Text Mesh Pro UGUI) elements (PosText, scoreText and nameText.
Underneath the transform add Drag in the highscoreEntryContainer , highscoreEntryTranforms and then the following (Text Mesh Pro UGUI) elements (PosText, scoreText and nameText
Press play this is all i did, plus tryed to make the [Field] text objects in one c#, were as gpt had me make an c# for Tmp text ojbects

silver fern
chilly vigil
silver fern
chilly vigil
silver fern
#

!code

radiant voidBOT
silver fern
#

can you copy it to one of those sites please

#

its hard to read otherwise

chilly vigil
silver fern
#

thx

chilly vigil
#

np

silver fern
#

at a glance this looks like it shouldn't crash

#

do you have the newest version of unity?

chilly vigil
#

2021 and no it is 6.2 or 6.1

silver fern
#

2021?

chilly vigil
#

yes 2021.3.24

silver fern
#

you're using a version from 4 years ago?

chilly vigil
#

i have 6.1 in my OneDrive, 2023.2.16f1 in my program files, 2022.3.3f in my OneDrive, 2021.3.2f1 in my OneDrive

silver fern
#

and which one are you using?

chilly vigil
#

2021 for this project

silver fern
#

try using 6.1 or 6.2

chilly vigil
#

ok should i store it in my onedrive or nah use my portable hardrive

silver fern
#

probably not

#

but I don't use onedrive so idk

chilly vigil
silver fern
#

yeah on harddrive is probably easier

naive pawn
#

yeah don't put unity projects in onedrive

chilly vigil
#

i have an hardrive with 1Tb

silver fern
#

thats fine

hoary spade
#

random question what is called when you have like final fantasy 2.5d sprite but then during battle you see a detailed character model like you would see in an anime

polar acorn
#

I don't think that's really called anything in particular

hoary spade
#

i figured i though it would ahve a name but you know what i mean right

minor pier
#

Does anyone have tips on some good baseline values for 2D Metroidvania-style movement? Right now my movement feels a bit off - I stay in the air too long and the speed doesn’t feel quite right. I’m just starting out, so I don’t have animations yet, but while testing and playing around it already feels off. Any advice would be appreciated!
(its just a capsule w/ rigid body and collider + camera)

naive pawn
#

!code

radiant voidBOT
languid pagoda
#

idk how much of a coding question this is I imagine it has to be done via code but im not really sure, but how do racing games make it so the car engine sounds different when the camera is inside the car in first person view? I actually opened up the game files and there are not seperate sounds for inside vs outside view.

minor pier
# minor pier Does anyone have tips on some good baseline values for 2D Metroidvania-style mov...
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
    GameObject player;
    Rigidbody2D rb;

    [Header("Player States")]
    public bool isGrounded = true;
    public bool isHoldingKey = false;

    [Header("Player Stats")]
    public float moveSpeed = 3f;
    public float jumpForce = 5f;
    public float stoppingSpeed = 0.5f;

    void Start()
    {
        player = this.gameObject;
        rb = player.GetComponent<Rigidbody2D>();
    }

    void FixedUpdate()
    {
        if (Input.GetKey(KeyCode.A))
        {
            rb.AddForce(Vector2.left * 3f, ForceMode2D.Impulse);
        }
        if (Input.GetKey(KeyCode.D))
        {
            rb.AddForce(Vector2.right * 3f, ForceMode2D.Impulse);
        }
        if (Input.GetKey(KeyCode.A) == false && Input.GetKey(KeyCode.D) == false)
        {
            rb.linearVelocity = new Vector2(rb.linearVelocity.x * stoppingSpeed, rb.linearVelocity.y);
        }

        Vector3 currentVelocity = rb.linearVelocity;
        currentVelocity.x = Mathf.Clamp(currentVelocity.x, -moveSpeed, moveSpeed);
        rb.linearVelocity = currentVelocity;

        // Jump
        if (Input.GetKey(KeyCode.Space) && isGrounded == true)
        {
            rb.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
            isGrounded = false;
        }
        if (Input.GetKey(KeyCode.Space) == false && rb.linearVelocityY > 0)
        {
            rb.linearVelocity = new Vector2(rb.linearVelocity.x, rb.linearVelocity.y * stoppingSpeed);
        }
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "ground")
        {
            isGrounded = true;
        }
    }
}```
#

^ this was the request right?

languid pagoda
naive pawn
naive pawn
#

keep in mind sound waves don't exist in the game engine - that's not what spatial audio is

languid pagoda
# naive pawn keep in mind sound waves don't exist in the game engine - that's not what spatia...

idk i haven't really touched it and when I did steam audio was what you had to use to use it in unity and it litteraly just did pathfinding and played the audio from the opened doorway for example instead of through the wall. I am very aware the sound waves dont exist in the game but my point was colliders would stop the sound from entering as that is the entire point of spatial audio or am I mistaken?

naive pawn
#

spatial audio is a concept, that's one possible implementation

silver fern
#

spatial audio usually means you can hear from which direction a sound is coming

naive pawn
#

(also solid objects don't fully block sound irl)

deep warren
#

can i ask something here?

languid pagoda
naive pawn
#

@languid pagoda in any case i think you should ask #🔊┃audio
it might be related to code but the folks there will know more about it

deep warren
#

What do I need to learn on Unity Learn to get the Unity Professional certification?

deep warren
deep warren
keen dew
#

You don't get the certification from Unity Learn. To get the Professional cert you need several years of work experience

hollow flare
#

i have an odd error with building in Xcode. is this a good place to ask?

keen dew
hollow flare
#

its for MacOS, im not porting to a mobile platform

keen dew
balmy vortex
#

hey so like how do you do ledge grabs in unity? I assume it has smth to do with raycasts but I'm not sure what the specifics are

silver fern
#

break it down into steps that the character needs to execute and do the appropriate checks

smoky ruin
#

https://streamable.com/n0me2i Well, my movement system has a small problem, every time it goes to a slope, and stays there, its vertical speed is not reset as it should be, causing it to have a residue of vertical speed, and when it leaves the slope, either from the sides or from above, it jumps by itself, simply by itself, could someone help me with this?

Watch "Test #2" on Streamable.

▶ Play video
#

I'm using Kinematic Character Controller

slender nymph
#

show code

smoky ruin
slender nymph
#

!code

radiant voidBOT
smoky ruin
#

oh, sorry

slender nymph
#

at no point do you appear to be resetting the vertical velocity, so unless the asset does that internally (which you'd have to consult its documentation and any relevant support channels to determine that) you should consider resetting the vertical velocity when it is on stable ground

smoky ruin
#

The KCC engine already does this task automatically and, for some reason, it does not reset the Vertical when on slopes, only on flat terrain.

slender nymph
#

then either reset it manually like i suggested, or if you think this is a bug in the asset then you need to report it to the asset developer through whatever support channels they have

cunning bramble
#

yo guys i need help i have an world text but i want it to be like XRAY so i can see it trouhg walls any ideas?

languid pagoda
#

Why is this code making the rotation rotate in the shortest path?

 void Update()
 {
     if (!needle) return;

     
     float t = (maxRPM <= minRPM) ? 0f : Mathf.InverseLerp(minRPM, maxRPM, engine.engineRPM);

     Quaternion target = Quaternion.Slerp(qMin, qMax, t);

     
    current = target;

     if (useWorldRotation) needle.rotation = current;
     else needle.localRotation = current;
 }

 // Keep your original signature but return eulers derived from quaternion slerp
 public Vector3 GetAngleFromRPM(float rpm)
 {
     float t = (maxRPM <= minRPM) ? 0f : Mathf.InverseLerp(minRPM, maxRPM, rpm);
     return Quaternion.Slerp(qMin, qMax, t).eulerAngles;
 }
vital otter
#

i hope its helpful though!

silver fern
vital otter
languid pagoda
silver fern
#

animation tween I'd say

languid pagoda
#

yuck

#

any other alternative?

#

I hate messing with those

#

lol

#

Thank you both for your intput tho none the less!

cunning bramble
#

yo guys i need help i have an world text but i want it to be like XRAY so i can see it trouhg walls any ideas?

vital otter
#

then it shouldnt take the shortest path because the lerp variable is taking the longest path

silver fern
#

that could work

cunning bramble
#

I will show you wait 10 sec

#

You seeing the difference?

#

@silver fern

silver fern
#

I don't know how to do this, you will probably have to use a shader

cunning bramble
#

okay but still thanks

grand snow
#

Or you draw it in overlay UI which is the correct way to do this

true raft
#

how to make a game with multiplayer and also move with hands

languid pagoda
timber tide
#

Better question is why do you slerp but return as eulers

#

either case slerp will always rotate shortest anyway

languid pagoda
rocky canyon
silver fern
#

looks like just using lerp like rebuild said is easiest

rocky canyon
#

my switches did that originally.. or maybe it was a door.. (but they both use the same script)
it would rotate around backwards b/c the new angle was closer

languid pagoda
# rocky canyon

I think the problem im having is in the editor I have to rotate it on 3 axis when I should really only have to on one too

rocky canyon
#

but yea

#

MoveTowards fixed it for me i think

rocky canyon
#

try changing these options ^

languid pagoda
#

im going to try movetwards

rocky canyon
# languid pagoda im going to try movetwards

gud luck

    private void Update()
    {
        float targetAngle = isOn ? max : min;
        currentAngle = Mathf.MoveTowards(currentAngle, targetAngle, speed * Time.deltaTime);
        ApplyRotation(currentAngle);
    }

    private void ApplyRotation(float _angle)
    {
        Vector3 euler = axis.normalized * _angle;
        transform.localRotation = Quaternion.Euler(euler);
    }``` this is the setup in the video ^ i sent
#

i have lots of things that require only a single axis to be rotated.. so i use the same script for everything that pivots..
Switches, Doors, Levers, Turntables, etc

#

i like doing it in code b/c i can easily reuse the code as well

#

ohh and i forgot to mention.. the axis is just a vector.. so i can easily swap which axis i want to use
0,1,0 1,0,0 or 0,0,1

languid pagoda
#

I dont have the option, like yeah I should be able to rotate it on one axis, but when I use the rotate gizmo in unity it changes rotation on all 3 axis so I wrote this.

 float t = Mathf.InverseLerp(minRPM, maxRPM, engine.engineRPM);

 var tarX = Mathf.MoveTowards(qMin.x, qMax.x, t* Time.deltaTime);
 var tarY = Mathf.MoveTowards(qMin.y, qMax.y, t * Time.deltaTime);
 var tarZ = Mathf.MoveTowards(qMin.z, qMax.z, t* Time.deltaTime);
 
 needle.localEulerAngles = new Vector3(tarX, tarY, tarZ);

not exactly sure what I did wrong but now the needle points out toward the driver.

rocky canyon
#

i used the Mathf b/c i only use a single axis

languid pagoda
#

Ill try that now but its probably going to result in same behavior.

I also tried needle.localRotation = Quaternion.Euler(new Vector3(tarX, tarY, tarZ));

rocky canyon
#

ahh ur running into Gimbal lock situations

#

is it a speedo needle?

#

why would u need to do anything more than a single axis? (Z) ?

languid pagoda
#

yep

#

idk why I need to but the 3d model is forcing me

#

i guess its a bad 3d model

#

but it looks good everything else about it is good so I am going to have to figure out a work around. I am about to just use a canvas ui and give it a digital dash 😂

rocky canyon
#

and rotate the EMPTY instead of the model

timber tide
#

Doesnt look like you need slerp here anyway. Just clamp and lerp between the new and old

#

angle^

languid pagoda
# timber tide angle^

angles* the 3d model requires rotation on all 3 axis to rotate the way I need it to

timber tide
#

we're talking about the speedometer here right

languid pagoda
timber tide
#

looks like it's just rotating a single axis to me

languid pagoda
timber tide
#

changing the values on the inspector is eulers

#

this is why you use quaternions

#

if the pivot is correct you should not have a problem with angleaxis

languid pagoda
#

I dont understand how I am meant to get the min/max angles if the inspector values arent relevant

#

also what axis should I rotate on if I cant look in the inspector to determine it

timber tide
#

depends how it's all imported

#

ideally you import it y-up, z-forward

#

which in that case means angle 0 here is 4 on the speedometer, and y would be its rotational axis

#

I'd make yourself an editor executable script with angle axis and mess with those values instead of touching the inspector values

timber tide
rocky canyon
# languid pagoda https://streamable.com/mxvsm7

ohh i see.. i was thinking more along the lines that it was an Overlay.. or something like a HUD
ya those rotations are gonna be influenced by all its parent objects.. bit of a sticky situation

languid pagoda
#

im trying the angle axis suggestion from Mao now and if that doesnt work it will be a UI Digital dash

rocky canyon
#

probably could put a gameobject a parent of the dial.. (rotate it so the dial aligns with it's axis) and use local rotations for the "Dial"..

#

could eliminate that awkward rotations

#

from the video im guessing that "tach" object has some odd scaling/rotations and isn't zero'd out

#

tried it myself.. lmao i forgot how much of a pain it is to get smooth values when doing speedometers

#

needs moar smoothing!! 🫠

rocky canyon
#

then doan

#

its something up the chain.. or this itself..

languid pagoda
rocky canyon
#

need clean values like 0,0,0

#

so if u rotate the Z.. then only the Z changes

#

i mean the gizmo makes it obvious..

#

that blue axis is not.. aligned with that needle 😅

languid pagoda
#

ok i figured it out now

#

need zeroed out

#

adjust parent to make it visualy correct

#

then rotate the child

rocky canyon
#

mmhmmm!

#

zero'd rotation
and 1,1,1 scaled
makes a happy 🌍

#

its always nice to test on things isolated too...

#

if ur working on scripting and logic.. best to use a simple object..
basic as can be.. zero rotation.. 1 scale.. no parents..

#

get the script working with that.. and u know the script is fine

nimble oracle
#

does anyone have some good videos/papers on world generation with perlin noise? im trying to get into it but the stuff ive made so far doesnt involve erosion, octaves etc

#

and trying to implement them myself has resulted in not much

rocky canyon
#

altho its not 💯 complete.. theres a few things he leaves out or assumes u know / find urself..

#

but overall its pretty decent

#

and heres another.. i haven't watched this one yet.. but the comments seem to give it praise

nimble oracle
rocky canyon
#

the second video seems good to explain it in theory

#

and not so much engine-specific