#💻┃code-beginner

1 messages · Page 430 of 1

slate haven
#

are u guys using Untiy 6?

iron blade
slate haven
#

How is it?

iron blade
slate haven
#

I am still using 2022.3.11f1

languid spire
slate haven
iron blade
iron blade
#

but now it moves so slow that it just falls

#

thanks for the help guys

slate haven
#

Decrease the mass

#

or increase the velocity speed

iron blade
slate haven
#

ur good

iron blade
#

🤣

slate haven
iron blade
#

look ima send u a video

slate haven
#

Alr

iron blade
languid spire
# iron blade

you probably want to freeze the x and z rotation on your rigidbody

iron blade
iron blade
#

thanks

slate haven
#

also do freeze position on Z if you don't wanna make it go in unwanted axis

#

if its just x movement

iron blade
#

nicee it works now

iron blade
#

with the z axis

slate haven
#

What game are you making

iron blade
#

so maybe a 3d platformer

slate haven
#

Thats nice

#

Just clear the fundamentals of local space and world space

#

if your using rigidbodies, thats gonna be really helpful

iron blade
#

How can i make the player no longer move if i stop pressing the key?

slate haven
#

Just add a condition

#

If (input > 0.1f)
{then move}

#

else dont

#

And You have to verify if thats just the input movement or the Physics affecting your object

languid spire
iron blade
#

by default

slate haven
#

Damn thats great

iron blade
#

i think ill learn that one since its more default now

slate haven
#

Yes, the new input system little hard on the brain but

#

its worth it

iron blade
#

you now have to manually install the Built in render pipeline templates

#

now the standard is those universal 2d and 3d ones

slate haven
#

urp as well?

iron blade
#

i installed the one on the bottom manually

slate haven
#

Ohh yeah its the same on every unity hub

#

not just unity 6

iron blade
#

ooh

#

alr

slate haven
#

I use the universal 3d rn

#

it has the urp template

iron blade
slate haven
#

does it happen to you that you understand the whole input system concept, or the movement logic. But when u type the code you just forget that what was it

charred pilot
#

is looking at learning plugin dev got some ideas is it c plus plus and .net

iron blade
#

before opening unity

copper python
#

It's called being human :P

iron blade
#

before waking up

#

🤣

languid spire
charred pilot
#

so .net is a good option

languid spire
#

for Unity dev? Of course

charred pilot
#

cool thanks

#

is the internal editor ok for a start

languid spire
charred pilot
#

yeah as a newb

languid spire
#

yes, but when you develop plugins you do so external to Unity

charred pilot
#

ok

slate haven
#

I used
rb.MoveRotation(Quaternion.Euler(25,12,135) in FixedUpdate()

Surprisingly it makes the object fly away. This only happened when I kept the 'Z' Axis value little high. Otherwise this didn't happen in smaller values.

Can anyone explain what's happening??

languid spire
storm pine
#

How can I do that a button could only be clicked once?
I have a button that decrease lives and after one click it changes, but if you click two times fast it just decrease 2 lives instead of 1, this is the click listener of the button:

optionButtons[index].onClick.AddListener(() =>
                    {
                        optionButtons[index].interactable = false;      
                        OnOptionSelected(isCorrect);
                        optionButtons[index].interactable = true;
                    });
slate haven
languid spire
#

I suspect you are looking at the wrong thing, this code alone will never cause 'flying away'

slate haven
#

So what would?

languid spire
#

anything which affects velocity

languid spire
eternal falconBOT
slate haven
#

RigidBody rb;

Void Start()
{

rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
rb.MoveRotation(Quaternion.Euler(25,12,145));

}

}

languid spire
storm pine
languid spire
iron blade
#

Yoo @slate haven

slate haven
slate haven
iron blade
storm pine
languid spire
slate haven
#

Once u get a hang of it, its better than the legacy

iron blade
#

Maybe u know how to fix it?

#

its at the end

storm pine
slate haven
cinder crag
# iron blade

you gotta check if the player is onGround , if he is then enable gravity , if he aint then disable gravity

#

or i think its reverse

languid spire
slate haven
storm pine
iron blade
cinder crag
#

cant remember on how i did it but i remember something with checking if ur onground

storm pine
languid spire
slate haven
slate haven
#

always put Rigidbody on parent

#

maybe try this

iron blade
slate haven
#

or create a new game Object

iron blade
slate haven
#

and try checking on that

#

do other gameobjects behave the same way?

#

to gravity

iron blade
slate haven
#

Try creating a new Game Object, put the scipt

#

script

iron blade
slate haven
#

and Rigidbody to it

slate haven
iron blade
#

cuz the y is always changing to 0f

slate haven
#

and see if its the same

iron blade
#

ima continue on my 2d game

slate haven
iron blade
#

wanna see some of it?

slate haven
#

sure

iron blade
#

working on damaging the player with the spike right now

#

@slate haven

hexed terrace
#

perhaps make a thread if you want to just talk about your game without help

#

or DM eachother

iron blade
languid spire
hexed terrace
#

This is a code channel, ask code related questions. To find out how to become an asset store publisher, I'd suggest googling and read the info Unity provide

iron blade
slate haven
idle ginkgo
#

so how do use the randomValue variable in update

languid spire
#

why do you have randomVal and randomValue ?

idle ginkgo
#

thanks for helping

still pond
#

ObjectDisposedException: SerializedProperty questions.Array.data[4] has disappeared!
UnityEditor.SerializedProperty.get_propertyPath () (at <fe7039efe678478d9c83e73bc6a6566d>:0)

Does this mean that im trying to acces an object that was deleted?

slender nymph
#

have you written any editor code? because that error is related to editor code

still pond
#

Im at very begging, i dont even know what editor code is. You mean c# scripts?

slender nymph
#

then the answer is likely: "that is an editor error. clear the console and move on"

still pond
#

ok thanks, so nothing to worry about

eternal needle
#

the size of the values mean nothing here, this is just a rotation. The issue is likely in your setup, maybe you have other code affecting this or there are overlapping colliders

#

also please dont record with your phone, record on your computer. there are many apps to do this, OBS is free and pretty widely used

slate haven
#

Oh yes, I had 2 colliders on the player as well

eternal needle
#

I can see colliders on the object in the video. Try recreating this in a new scene, a basic cube and only attach this script.

slate haven
#

So yeah they interacted with each other

#

Solved it

upper tide
#

Is it correct to say that the behavior of method hiding is that whe you cast the derived class into the base class, the original base class method is called instead of the "new" keyword defined method;

whereas method overriding will call the derived "override" keyword defined method regardless of what class it's being cast to

slender nymph
#

yes

upper tide
#

Thank you

slender nymph
upper tide
#

Very comprehensive and quick demo

queen adder
#

Question: So I have this Recoil function, it get called once per click, no update

//Unrelated logic removed && names shortened
    public void DoRecoil()
    {
        recoiledRot += new Vector3(x, randY, randZ);
        transform.localRotation = Quaternion.Euler(transform.localRotation.eulerAngles + recoiledRot);
        recoiledRot = Vector3.zero;
    }

This script lerps all the stuff back to its original place

    void Update()
    {
        lerpedRot = Vector3.Lerp(lerpedRot, desiredRot, rotLerpSpeed * Time.fixedDeltaTime);
        transform.localRotation = Quaternion.Euler(lerpedRot);
    }

but it is failing to do that with the rotation, probably because I dont know how to properly lerp rotation, any help?

#

Im trying out other stuff rn, its the issue with me lerping euler angles directly prob

slender nymph
#

the lerp you've shown appears to have nothing at all to do with the DoRecoil method you've shown as none of the values used in either method are used in the other. Not only that, but you are using fixedDeltaTime in Update for some reason, that is going to make it go faster on higher framerates because fixedDeltaTime does not change as the framerate changes like deltaTime does. also that's a "wrong lerp" and ideally when dealing with rotations you'd use Slerp not Lerp

mint lodge
#

Hey guys

#

How do I enable Magnet/Snapping tools here?

slender nymph
#

this is a code channel. but if the tools aren't showing up there, then select the 3 dot button in the upper right of the scene view window to open them again

mint lodge
#

I'm sorry, I don't know the right channel

3 dots don't show any snapping options though

queen adder
# slender nymph the lerp you've shown appears to have nothing at all to do with the DoRecoil met...

Yeah, well they are related indirectly, the second script is only supposed to lerp the gun back into its position, its easier because I can just add a recoil to the gun, and it will get moved back by the other script, I need it to be like that because of unrelated reasons

Im aware im doing wrong Lerp for now, might not even change it because I dont need it to be accurate

It works as I want it with positions, but I didnt show that in the samples I gave

#

Give me some time, I messed up big time on the lerp again

atomic holly
#

Hi,
For search a gameObject in a scene with 50 others gameobject in it, is it more optimised to use GameObject.Find() orGameObject.FindWithTag()

frosty hound
#

Well, searching with tags means only searching objects with tags vs every object by its name.

ivory bobcat
atomic holly
ivory bobcat
#

Hmmm, maybe have a Singleton manager and have the new instances register themselves as references with the manager on Start or something. You would be able to access the two instances directly instead of having to search. For instance, player one and two would just tell the manager which objects in the scene they are and every other object within this scene thereon could access them directly using the manager.

verbal dome
atomic holly
primal trench
#

i think this is where to put this but I'm trying to push my unity project to github
I have git lfs installed and registered to recognize .dylib files
every time i try to push i get this error:

remote: error: See https://gh.io/lfs for more information.
remote: error: File Library/PackageCache/com.unity.burst@1.8.16/.Runtime/libburst-llvm-16.dylib is 124.60 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/Myusername/myproject
 ! [remote rejected]   master -> master (pre-receive hook declined)```
#

I've been hitting my head at this for an hour now and idk why it's not working

#

i also have the gitignore recommended for unity

ivory bobcat
#
private void Start()
{
    PlayerManager.Instance.PlayerOne = this;//Set this object as player one with regards to the manager
}```
atomic holly
ivory bobcat
atomic holly
#

Just do a SIngletonManager and take their instance

primal trench
#

and it has the file recognized

ivory bobcat
atomic holly
#

So I was wrong

#

And so, PlayerOne is a gameobject stock in the Playermanager script right ?

ivory bobcat
#

It would be an accessible member of an instance of the PlayerManager script - a field or anything (my naming convention implies it's a property).

#

You can lookup Singleton patterns with Unity on Google - pretty sure vertx has got a generic example somewhere as well. Assuming the Singleton registers itself as the unique instance in Awake and prohibits other managers from existing (as intended with the Singleton pattern), you'd just tell the manager who you are per scene in Start (assuming every scene would attempt to create a manager if one doesn't already exist).

strong wren
stone saddle
#

Could anyone please help with detecting collisions with touch screen actions? Ive been able to get tapping to work but I need to be able to swipe through the object as well. https://pastebin.com/Wj4skwPr

primal trench
rich egret
#

hi

#

All my scripts are not working, what to do?

wintry quarry
#

First check your console window for any compile errors

rich egret
wintry quarry
#

Show your errors

rich egret
#

And this is not a problem with one script, it is about all scripts

polar acorn
wintry quarry
#

Show the first error.

polar acorn
wintry quarry
#

Once you fix the compile errors it will work

rich egret
#

It just says "This is not allowed" every time I try to open a script

polar acorn
#

Clear the console, show whatever is left, starting at the top

wintry quarry
rich egret
polar acorn
rich egret
#

Just one problem with a script I'm programming now

polar acorn
#

You need to fix that before anything can compile

wintry quarry
rich egret
#

ok its working

#

@polar acorn @wintry quarry TYSM

copper matrix
#

so i put it at the dge of the map and i still cant put it over the map. I tried it over transform position and Layer Selection but it still doesnt work. the Problem is im working with a duo who designed the Tiles for the map so idk what he did

idle ginkgo
#

my player gets stuck on the edges sometimes

pliant sleet
#

When using Physics.Raycast and you want the distance between the player and the object, what does the "out hit" do in that case ?

pearl temple
#

new to c# and unity.
Are strings compared by reference before being compared by value?
So comparing two strings is actually fast?

wintry quarry
steep rose
pearl temple
wintry quarry
#

there's no guarantee the two strings are the same instance

#

unless you're using a const field or something

#

in which case you might as well just use an enum

#

it's still likely fast enough, it depends on your use case

pearl temple
#

well I am just porting code now, ported my plugin from unreal to godot, now from godot to unity.
Unreal had FName which are basically hashed so comparing two of them is just comparing an integer.
Godot has StringName which as far as I understand are just immutable string, also compared by ref.

I couldn't find a unity equivalent to either, but I figured if the strings are compared by reference that is close-ish

#

problem with an enum is that I don't know all possible values at compile time, since users can add more

pearl temple
#

Yes..., I meant that the reason I am not using enums is that I don't know the values beforehand

wintry quarry
#

I think you're probably prematurely optimizing worrying about this though

pearl temple
#

sure, but that is a one time thing

wintry quarry
pearl temple
#

Ehh, I am hitting a hashmap with hundreds of elements on update for hundreds of objects

wintry quarry
#

on the target hardware

pearl temple
#

not yet in unity. since I just started porting it

wintry quarry
#

Do it the most straightforward way first, and profile it

#

if you have a performance issue, then worry about optimizing it

hollow vortex
#

@steep rose for some reason im not allowed to send a pic or sum

#

maybe bad internet, idk

#

but I have three parameters, and 6 transitions, 2 between every animation

steep rose
#

what do you mean by "it was not being animated at first (cuz its js some few blinks)"?

hollow vortex
#

im triggering it when the MouseButtonDown, so idk if its related but its not long

#

making it with no exit time fixed it, but I mean it aint exiting

#

my code made it not work both ways lol

steep rose
#

you mean the bool is not turning false and stopping the animation?

#

or the animation stops to quickly

hollow vortex
#

at first it didnt even play I think

steep rose
#

now what does it do

hollow vortex
#

well, the animation just sometimes play

#

and sometimes not

#

and it never plays while idle

steep rose
#

yeah im gonna need to see that animator, the code looks fine. its probably something with the animator

hollow vortex
#

its giving me upload fail

#

oh nvm lemme use a vpn

#

ight should be sent now

#

still slow af

steep rose
#

if my memory serves me correct I believe there is a duration float in the parameters on the animations

#

i would have to check for myself

hollow vortex
#

on the animation or transition?

steep rose
#

check on both

hollow vortex
#

ight the shooting animation

#

the is shooting boolean is def becoming true

signal mango
#

But it's worth noting you can only turn it back into a string in the editor

steep rose
# hollow vortex

you may need someone else for this, I was familiar with the animator but i havent used it in a while. From what im seeing it might be something with exit time, im gonna have to reintroduce myself to this to be able to help fully.
I know there are people that can help that have way better knowledge than I do

signal mango
#

Also worth noting that while FName is (iirc?) case-insensitive, PropertyName is case-sensitive

steep rose
#

Im still gonna try to help but it might take me a minute

tropic rose
#

In my unity project I want my character to turn (rotate) and move towards the closest enemy when the attack button is pressed, but at the moment these movements happen instantly and I have no idea how I can lerp them.
I use the following code:
transform.LookAt(targetLocation);
characterController.Move(targetDirection * speed * Time.deltaTime);
Originally I thought multiplying with Time.deltaTime would do the trick, but it doesn't. Anyone know how to do it properly?

wintry quarry
#

something like:

Vector3 direction = targetLocation - transform.position;
Quaternion targetRotation = Quaternion.LookRotation(direction);
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);```
vital vale
#

Does someone have an example parallax horizontal scrolling for 2d background

upper tide
#

Is it better to write code with properties instead of fields? Read online that it was better practice because you get proper encapsulation, but I find the unnecessary get/set to be a bit frustrating

upper tide
rich adder
# vital vale

this isn't really a code question. Also did you look it up.. they have so many guides on this

wintry quarry
upper tide
polar acorn
wintry quarry
upper tide
#

Also was wondering, what exactly is the difference between Delegates and Action? The way you set them up seem identical

rich adder
#

Action is a del

polar acorn
wintry quarry
#

Sort of like how an Apple is a fruit. So you kind of asked "What's the difference between Apples and Fruits?"

upper tide
#

And in this cse delegate is fruit and apple is the type

wintry quarry
#

Apple is Action

#

Fruit is delegates

upper tide
quasi veldt
#

Alright, math time because I'm messing up worldspace conversion, and I'm not sure where I'm going wrong.

I need to do three things. Listed in order of least likely to have messed up to most.

1: get what the position and rotation of object A would B in A's localspace (which I need for later)
this is done via:


localPosOffset = referenceObject.transform.InverseTransformPoint(this.transform.position); //if we were a child of ReferenceObject, this is what our local position would be.

        Vector3 tempRightForward = this.transform.InverseTransformDirection(referenceObject.transform.forward);
        Vector3 tempRightUp = this.transform.InverseTransformDirection(referenceObject.transform.up);

        localRotOffset= Quaternion.LookRotation(tempRightForward, tempRightUp); //if we were a child object of ReferenceObject, this is what our local rotation would be

From what I can tell, this works perfectly.

I apply it, which also works perfectly, by:

            thing.localPosition = localPosOffset;
            thing.localRotation = thingsparenttransform.localRotation * (localRotOffset);

Where I'm stuck is inverting this w/ the offset I have, so that instead of the values being used to create a child object under the parent, it makes an instance of the parent in the same relative rotation around it (without rotating the object itself), so i can configure it. Works one way atm, but not the other.

my current "stab" at it is dumb, and doesn't properly consider rotation or anything, so I'm kinda fishing here.:

        wouldBeParentObject.transform.position = this.transform.TransformPoint(-localPosOffset); //also dumb.
        
        wouldBeParentObject.transform.rotation = Quaternion.Inverse(localRotOffset); //dumb
#

basically I get the local offsets of B, which when applied to a child of A result in it being in the same spot as B.

With these same offsets, is it possible to get the inverse, so I can spawn an object & have it be where A would be, if B were the child of A (but it's not, it's just worldspace so I can config an object)

river quiver
#
int randomSoundNum = Mathf.RoundToInt(Random.Range(1.0f, 2.0f));

if (randomSoundNum == 1)
{
    bagietaDyingClip = Resources.Load<AudioClip>("AudioClips/Bagieta-dying.mp3");
}
else
{
    bagietaDyingClip = Resources.Load<AudioClip>("AudioClips/Bagieta-dying-2.mp3");
}

playerAudioSource.clip = bagietaDyingClip;
playerAudioSource.Play();```
why is this not working
#

i have the bagietaDyingClip variable assigned earlier not in the function itself

river quiver
#

its not playing, atleast i dont hear it

wintry quarry
river quiver
#

could it be something in the unitys settings?

#

its running when the player dies in the gameover function

wintry quarry
polar acorn
wintry quarry
#

In which case, are you destroying the audio source?

river quiver
#

im not nothing is getting destroyed

#

it runs when a player collides with a wall or goes out of bounds

wintry quarry
#

well again, you should start with checking if the code actually runs

wintry quarry
river quiver
wintry quarry
#

is in Update?

river quiver
#

yh

wintry quarry
#

if so it's going to run every frame

#

and restart the sound every frame

#

but - again you need to check that your code is actually running

polar acorn
river quiver
wintry quarry
#

really you should use Debug.Log to check this

quasi veldt
polar acorn
quasi veldt
# polar acorn Okay, so you want a sort of snapshot of the local transform values of `A` as if ...

Yeah, basically. Let's use hands as an example because I'm gonna keep mixing up A/B

Ae, I record the local position of a ball where it'd be in a hand relative to the hand, so I can just move the ball (or Ig attachment point if we're doing hand stuff) to the offset (in local space) to have it match.

to configure the hands, I wanna spawn them in so the offset between them (ae, hand to object) is equal to what I have recorded, but without rotating the base object. So if the hand was configured to be on top of the ball, and I tipped it back 90 degrees or whatever, it'd be on top (but with the same end result if I recorded the offsets again)

river quiver
#

@wintry quarry it was becase i added the format at the end .mp3 lol

polar acorn
# quasi veldt Yeah, basically. Let's use hands as an example because I'm gonna keep mixing up ...

Okay, so, if you had a ball in the palm of your hand while your hand is held straight out, you'd want to be able to spawn a ball in the palm of your hand while it's upright like a waiter holding a tray. The hand moves and rotates, and you need to keep the relative position.

Just want to make sure we've got the right idea of what the intention is so we don't get too into the weeds of trying to make a specific solution work, in case there's a different way to solve it that might be better

quasi veldt
# polar acorn Okay, so, if you had a ball in the palm of your hand while your hand is held str...

In this case the hand stuff is handled. I can apply the offset to the attachment point on the hand and it'll match up perfectly fine

I'm trying to do the inverse of it. everything would still be the same distance/orientation/etc, but with the ball as the parent instead of the hand. basically applying the offset I recorded (from hand to ideal ball position) backwards, to get where the hand would be if in worldspace the ball was both it's child & in the same position/rotation it currently is

polar acorn
quasi veldt
#

Yeah, no problem. it stumped me too.
Idk if this diagram helps but here;

polar acorn
#

Okay, so, the local position and rotation are basically the difference between the parent and the child, right?
That would mean the hand's transform should be at the ball's world position minus the offset, and the rotation be the world rotation of the ball minus the offset rotation.

I have no idea how to do the quaternion math on that, but let's try it with the position first and see if this idea is sound at least?

wouldBeParentObject.transform.position = transform.position - localPosOffset;
#

If this puts it where we want the parent object to be, I can figure out the math

quasi veldt
quasi veldt
#

yeah, .TransformPoint also doesn't work, presumably because the offset only works in localposition if the rotation's right. hm

#

Unfortunately I can't just record the offset both ways, as it's open to direct user (or configurator ig) editing, I've gotta work backwards here.

#

this double sucks as the unity discussions pages keep giving me 403s (probably because the migration, which I'm sure will go well clueless )

polar acorn
#

Yeah, I'm trying to fiddle with it on my end and am also coming up with bupkis. I'm gonna have to ponder this for a while, this is actually starting to eat into my actual job time. If I come up with something and no one else has come up with anything I'll ping you

quasi veldt
#

Gotcha. I'll ping you if I figure it out lol

stuck palm
#

is there a gizmos.drawcapsule?

timber tide
#

can always just instantiate meshes with wireframe shaders

#

or transparency

stuck palm
#

i have this really long annoying if statement for different types of collisions. I feel like its really inefficient and was wondering how i could make it better? I have 4 different shapes so i'd have to make 16 versions of this to keep this up 😭

https://gdl.space/epenagewit.cs

rocky canyon
stuck palm
stray thorn
#

is there sideways movement on a rigidbody? im trying to my character left and right without looking in that direction but i only know Rigidbody.forward()

#

to move**

polar acorn
#

So if you're looking for something like that for sideways, that also doesn't exist

stray thorn
#

mb

summer stump
#

There is transform.forward
And transform.right

#

Etc

#

You can easily look up the docs for the transform component and see it all. That should always be your first stop

stray thorn
stuck palm
#

is directly checking class type expensive in the context of a physics simulation?

summer stump
stray thorn
#

i just summarized

#

thx

void raptor
#

Can someone help me with this bug?

polar acorn
void raptor
#

lemme try

#

@polar acorn it gives me the same value when game starts even if i am too close

void raptor
#

ye

hollow vortex
#

my entry state dissapeard lol

polar acorn
# void raptor

And it's always that distance, even when moving the player around?

hollow vortex
#

it also giving me errors with nothing relateed to my code

#

nvm reset and everythin worked (and gone as well)

steep rose
#

float dist = Vector3.Distance(other.position, transform.position);

steep rose
#

dist < 5

#

thats on the documentation

void raptor
polar acorn
# void raptor Yes

Then the distance between this object and whatever object you've assigned to player is 12.48762

#

And that object is not the one that moves around

steep rose
#

other.position first then transform.position

#

brb

summer stump
summer stump
#

Try typing Player into the hierarchy search

stray thorn
#

does anyone know how to check if my character is grounded? is there a isgrounded function in rigidbody?

summer stump
summer stump
steep rose
stray thorn
#

alr ty

void raptor
polar acorn
hollow vortex
#

can someone help me fix something in my code

#

for some reason it's not affecting animtor's variable

#

it was working a bit ago but I had to reset my animator

steep rose
#

I just posted what it said on the documentation

hollow vortex
steep rose
hollow vortex
#

oh mb

eternal needle
steep rose
summer stump
void raptor
# void raptor

is it a navmesh problem? becouse not even chat gpt managed to fix me this bug

summer stump
#

You say "not even" as if gpt was capable of fixing it

polar acorn
eternal needle
# steep rose I dont have unity open

That's irrelevant. I'm just pointing out you really shouldnt just be guessing at issues if you arent confident in what the problem is. Most of us stay out of problems we arent knowledgeable about

void raptor
polar acorn
#

Whatever object player is set to is not the one that's moving around

summer stump
void raptor
polar acorn
void raptor
#

Yes it is

summer stump
summer stump
#

Ok, and you did not drag in a prefab?

void raptor
polar acorn
# void raptor Yes it is

If it were, then the distance would be changing. Since the distance is not changing, the only conclusion is that the object your player variable holds is not moving.

summer stump
polar acorn
#

If you're certain the assignment is correct, then Player does not move.

polar acorn
#

Check the inspector for Player as you move around. Does the position change?

polar acorn
summer stump
#

In ter es ting

What have you been moving then?

spiral glen
#

anyone have any unity functions that may help me create a draggable screen because I can't think of anywhere to start

void raptor
#

i forgor that player was an empty objectnotlikethis

#

so i put player body and it works

summer stump
#

Wait. So you are moving the child and not the parent?

#

Generally you move the parent, and have the model and animations on the child

summer pilot
#

not exactly a direct coding question, this is more vscode related:

does anyone know what extension provides this "tab to complete" option?

summer pilot
rich adder
#

also thats Visual Studio not vscode

summer pilot
#

oh, there's a difference???

rich adder
#

yes very much lol

summer pilot
#

i've always called my visual studio vs

#

LMFAO

#

WHOOPS

#

i thought vs was short for visual studio

polar acorn
#

It is

#

VSCode is not VS

rich adder
#

visualstudio Visual Studio is a true IDE,
vscode Visual Studio Code is a text editor that can become somewhat of IDE with extensions

summer pilot
#

ahhhhh

mint lodge
#

Hey guys

#

So I'm trying to create this obstacle (orange rect) that is activated by a Trigger

#

and moves ping pong between two points

#

but even though my code works in a similar object that isn't activated by a trigger

#

it refuses to work for this triggered obstacle

#

It moves to the first point and pauses

#

I tried diffferent approaches and it either jitters after reaching the first point or pauses

rich adder
#

start by sharing code ⏬

eternal falconBOT
mint lodge
#

it's big 😅

rich adder
languid spire
#

thats why the bot has a section marked large code blocks

mint lodge
#

No sorry

signal mango
#

I'm surprised it doesn't suggest GitHub Gist

#

I guess since you need an account

rich adder
#

why ? thats more work. more friction..

signal mango
#

What do you mean?

mint lodge
#

Can I send a txt file?

rich adder
mint lodge
#

Ohhhh

rich adder
#

putting Logs inside these functions to see what what the current values are vs what you expect, and if they print in the first place

signal mango
rich adder
#

we know

#

like you said you need to be logged in the first place

mint lodge
#

and also alternating

rich adder
mint lodge
#
    private Vector2 GetCorrectNextPosition()
    {
        nextPointPos = points[pointIndex].transform.position;
        print(nextPointPos);
        print(string.Format("The point index is {0}", pointIndex));
        return nextPointPos;
    }```
#

Called on Update

#

The block reaches the first Point and then prints the position of the other point and the correct index

Then the position of the point the block is jittering at and its index

rich adder
#

where is that here, i dont see it

mint lodge
#

old version with same problem

#

It's only this function called at the start of Update

mint lodge
rich adder
#

is the trigger a rigidbody?

summer pilot
rich adder
summer pilot
#

Visual Studio Code

mint lodge
rich adder
summer pilot
rich adder
mint lodge
stray thorn
#

anyone know how i can limit the range to 90, -90?

mint lodge
stray thorn
#

wdym?

#

is there a unity doc on things like this?

summer stump
rich adder
summer pilot
summer stump
mint lodge
#

I'll try using a SerializeField private var for the Rhino

rich adder
rich adder
mint lodge
#

They are empty Game Objects with a transform

#

not visible in the Scene

rich adder
#

thats why i said put logs in the code and see if the function is still running

rich adder
rich adder
mint lodge
#

Good idea

#

and increase render layer order

stuck palm
#
public abstract class FixedCollider : MonoBehaviour
{
    
    public Entity _entity;
    
    public ColliderShape colliderShape;
    
    public Fix64 radius;
    
    public Fix64 height;
    
    public fv2 center;
   
    public fv2 size;

is there a way to hide some of these fields for sub classes that wont use them? like a box or polygon collider wont use radius

rich adder
#

click the Dropdown next to the name and assign an icon u can see in the scene

#

i usually pick the diamond one

mint lodge
#

You mean this right

#

It already has the orange one, I thought they don't show up in the Scene

#

that's why I'm adding sprite with high render order

rich adder
stray thorn
#

its not working but its not showing any error

rich adder
#

sprite renderer has no differences on gizmos, they are completely different

rich adder
#

Clamp is a function that returns a result..

stray thorn
#

there was no example of scenario

rich adder
#

what

stray thorn
steep rose
#

bor

rich adder
stray thorn
rich adder
#

you look at them to figure out how its being used..

steep rose
#

am i having a stroke or something 😅

#

i think so

rich adder
rich adder
#

eg what return type the function has etc..

stray thorn
#

i started 4 days ago gng i dont get why ur being harsh

#

thx tho

rich adder
mint lodge
steep rose
#

hes not being harsh

rich adder
mint lodge
#

one sec compiling

#

caught the bug red handed

#

Thanks for telling me to debug again, I still have to think about how to fix this though lol

#

So it's not actually changing the Point

steep rose
#

could I see some code?

mint lodge
#

Yes one sec pls

rich adder
#

but yeah debugging is the best way to find these little things

mint lodge
mint lodge
summer pilot
#

how do i find my debug log, im logging information to it but it's nowhere to be found

summer stump
#

Make sure the toggle is not deselected on the top right

#

And if it is not toggled off, and you do not see the log, then that code is not executing

summer pilot
steep rose
#

it should be open at the bottom of your screen

summer pilot
#

thats my problem

#

its not there

summer stump
#

Go into windows at the top, go into panels, and click console

rich adder
#

you can add as many as you want too

rich adder
#

you can probably do Via Add Tab

#

3 dots button

summer stump
#

@summer pilot Or you can click the blank space at the very bottom (which may or may not have words)

#

Maybe it is under analysis? Can't remember where exactly in the windows menu. Just look around if you go that route

summer pilot
rich adder
mint lodge
#

IT'S WORKING

summer stump
#

If you google "unity console" it will of course tell you exactly how to get there

polar acorn
# summer pilot

Check the other foldouts. Pretty sure console is under "General"

summer pilot
polar acorn
#

But there's not many to look through

mint lodge
#

Thank you @rich adder

rich adder
#

thats the ONE they dont have wtf lol

summer stump
# summer pilot

Stop sending pictures. Just look through all the windows menus

summer pilot
summer stump
#

Or google it

rich adder
#

UX failure

summer pilot
summer stump
summer pilot
steep rose
#

woah now, lets cool it

summer pilot
summer stump
# summer pilot when there are others who are walking me through where to look, i don't need you...

Sending pictures over and over IS doing something wrong.
And I told you exactly where to look

I was the one who told you it was in the console, and to look in the windows menus.
But whatever, if you wanna be rude, just gonna block you.

Best of luck with everything. Please be nicer to others and grow up in the future, because this is not it

You are welcome for being the first person to help you and tell you everything you need.

summer pilot
#

whatever man

mint lodge
#

Stop fighting

#

It's called Unity

steep rose
#

now that is true

stone saddle
#

is anyone able to tell me if this is correct? no debug messages are being printed when the objects interact and i dont see any issues with tags or colliders.

polar acorn
#

See if that prints

stone saddle
#

nope, still nothing

#

i cant find the issue

polar acorn
#

The Three Commandments of OnTriggerEnter:

  1. Thou Shalt have a 3D Collider on each object
  2. Thou Shalt tick isTrigger on at least one of them
  3. Thou Shalt have a 3D Rigidbody on at least one of them
half egret
#

The 3rd commandment is one I always forget

stone saddle
#

would the game being 2d perchance make a difference

#

did i forget a 2d somewhere

polar acorn
#

Because this is the 3D OnTriggerEnter function

stone saddle
#

ahh

polar acorn
#

You should probably be using OnTriggerEnter2D

mint lodge
#

How did IntelliSense not correct you

polar acorn
#

It just isn't called by a 2D Rigidbody

mint lodge
#

Mine turns to 2D automatically

#

I'm working in a 2D project

stone saddle
#

works fine now, stupid mistake, thanks

mint lodge
#

Okay, well not auto, I press down arrow when the suggestions pop up

ashen trail
#

Why doesn't my collision detection work?

polar acorn
stone saddle
#

lol

steep rose
#

😂

#

bros got that in chamber

ashen trail
summer stump
mint lodge
#

I have a question

steep rose
#

shoot

mint lodge
#

I want to create an Obstacle that moves this way

polar acorn
#

Well, specifically, absolute value of sine

mint lodge
#

on Y axis I presume?

half egret
mint lodge
#

no, X

polar acorn
#

If that's the axis you want it to move on

half egret
#

That sees this exactly

mint lodge
#

Thank you, I'll check out both ways

quasi veldt
polar acorn
quasi veldt
#

it's a shitty option but it's better than it not working. Ideally I'd understand the math but ig my brain isn't big enough for that yet

ashen trail
#

How can I make a bullet shoot from a players position but not destroy the player? Is the solution to spawn the bullet just a bit in front of the player or is there another way?

summer stump
#

Validate the collision

polar acorn
summer stump
#

if (thing I want to destroy)

ashen trail
#

Thank you I saw your comment earlier but I just wasn't sure how to validate the collision

eternal needle
#

I also really wouldnt have objects just destroying other objects like this

ashen trail
#

Do I hake different bullet prefabs for the enemy because if I tell the bullet to not destroy the player than the people firing at the player can't do anything.

ashen trail
summer stump
#

Or have a bool on your script that tells it whether it is the player or not.

If not, damage player
If it is, don't

#

There are many ways to do it

ashen trail
#

Okay, the bool makes sense to me, I will try coding that and see how it goes.

eternal needle
stray thorn
#

i have a capsule as my player and it keeps tipping over since i have a rigidbody, how do i freeze the y and z coordinates of the rotation and keep the x availible

mint remnant
#

there's constraints on the rigifbody for rotation and position you can toggle

steep rose
#

make sure you are not in debug mode, ive made that mistake 1 to many times 😅

stray thorn
half egret
#

Show your constraints

eternal needle
stone saddle
#

I researched the issue and it said this could be code related? Not sure what it means by type mismatch.

#

what type does it want its just an object with a script

stray thorn
#

tysm

polar acorn
stone saddle
#

im trying to reference another script named money manager

rocky canyon
polar acorn
stone saddle
polar acorn
# stone saddle

Okay, and are either of the objects involved in this prefabs?

stone saddle
#

ah yeah

#

the one with ball controller is a prefab

#

a ball

polar acorn
#

Prefabs cannot reference objects in the scene

rocky canyon
#

so, unless ur MoneyManager is inside that prefab u can't drag a reference in like that

polar acorn
#

you need to set the reference on the instance in the scene after creating it

rocky canyon
#

you need to assign it during runtime via some assignment in Awake() or Start()

stone saddle
#

ohhh

#

thank you

rocky canyon
#

or some other type of interaction between the 2

stone saddle
#

Its hard to remember all of these seemingly small things

rocky canyon
#

mmhmm, it becomes muscle-memory-esque

#

the longer u do it

devout flower
#

Is Task.Delay the only thing for tasks that doesn’t work in webGl

ashen trail
#

Am I calling for the player position wrong?

frosty hound
#

No, that is how you get the position of an object.

#

But you're assigning the position to a Transform type, they're not the same.

topaz niche
rocky canyon
#

i dont build in webGL very often.. but its something i been meaning to educate myself about

polar acorn
#

@topaz niche Go into 3D mode, show where the objects are in relation to the camera frustum

rocky canyon
loud mango
#

why does rb2d.AddForce not work on android build? It works in the editor

jaunty wedge
polar acorn
rocky canyon
#

Transform is the <Type>
transform is the specific Transform the script is attached to

polar acorn
#

your FirePoint variable is a Transform. Player.transform.position is a Vector3. These are different types

rocky canyon
#

transform.position <-- "this transforms position"

loud mango
ashen trail
polar acorn
rocky canyon
#

Firepoint = Player.transform ❔ ❓

loud mango
#

why does rb2d.AddForce not work on android build? It works in the editor
i am trying to make a jetpack kind of thing, it tried it with transform.position += ( code )
HELP PLEASE 🙏

steep rose
#

dude

ashen trail
#

omg that worked, sorry I couldn't understand a lot of stuff you guys were saying I'm not too good at coding.

steep rose
#

i was just getting to you, chill

rocky canyon
# ashen trail

Firepoint is a Transform...
Player.transform.position is a Vector3..
Player.transform is a Transform..

polar acorn
loud mango
polar acorn
#

And what you're actually doing with it

steep rose
languid spire
loud mango
#

it clicks the button but it just doesnt fly

rocky canyon
#

so you've debugged the method and confirmed that the code is indeed running

loud mango
#

the code is correct

#

cuz i tried flying with a different method, it works

#

just the AddForce doesnt work

polar acorn
#

They'll fight with each other. You should use entirely teleportation or entirely physics

loud mango
#

using force based in left/right isnt what i want

#

but using teleportation based on jumping is fighting with the gravity

languid spire
grand cosmos
#

alright thanks

jaunty wedge
#

Hey, I'm making a rhythm 2d game and I want to add telegraphs to the attacks, but the issue I've ran into is that I need to spawn the attacks on beat, rather than the telegraphs. Does anybody know whether async is better than using coroutines?

#

I've done it so that the telegraph spawns exactly 1 beat before the following attack does, and it fades in and out before being destroyed. The attack should spawn right when the telegraph is completely visible, and the only way I could figure out was using async or coroutines, but I'm not sure if that's the best solution

thorny basalt
jaunty wedge
crystal chasm
#

What's the issue?

jaunty wedge
#

the errors itself don't really do much as when they appear the game is already ended but they still are a sign that I might be doing something wrong

#
Your script should either check if it is null or you should not destroy the object.```
crystal chasm
#

Why are you using an int for the timer?

jaunty wedge
#

because that's what the Task.Delay() function takes in

crystal chasm
#

Oh. Lol

jaunty wedge
#

that's actually the reason why I started doubting using async, as the resulted time in milliseconds comes out to be not as precise

#

for example: with a bpm of 128 each beat takes 0,46875 seconds to play, but the same value in milliseconds can only be represented as 468/469.

crystal chasm
#

Yeah. That doesn't sound very precise

jaunty wedge
#

I'm just curious whether using coroutines would be a better solution to this

#

or if there's any other viable solution

crystal chasm
#

Coroutines you can at least use a float

jaunty wedge
#

true

#

but then I need to start the coroutine in a separated function

#

and use that one instead

#

so it is quite odd to use as well

#

there's actually a bunch more issues I've had with the way I implemented telegraphs, but it would be too complicated to put in a single message or a screenshot

#

so I'm just searching for solutions from the rock bottom lol

crystal chasm
#

That's all you can do sometimes.

frank zodiac
#

not really a coding concept but i just want to ask; what is multithreading and why do we use it

polar acorn
# frank zodiac not really a coding concept but i just want to ask; what is multithreading and w...

CPU cores can only do one thing at a time, ever. Your computer seems like it is doing a bunch at once but it's actually just changing between them very fast.

Modern CPUs actually have more than one core, so each core can do a different thing. Multithreading is writing code that can run on multiple cores at once, letting you actually do more than one thing at once. This is generally not actually used in Unity, because UnityEngine functions only work on the main thread.

frank zodiac
#

outside of unity

#

i mean anywhere whatever game engine

polar acorn
#

Depends on the language

frank zodiac
rich adder
rich adder
frank zodiac
#

about things other than unity

#

the only reason i asked in this server was because quite frankly all the other servers are dead

stuck palm
#

why do some of the scripts not have an option to be disabled?

polar acorn
rocky canyon
polar acorn
#

So, if there's no Start or Update or anything, it doesn't give you a checkmark

stuck palm
#

right

spiral glen
#

is it possible to fill an entire array (hypothetically of a size of 3 values) without doing:

array[0] = blah
array[1] = blah2
array[2] = blah3
spiral glen
rich adder
#

what are you trying to do exactly

spiral glen
#

I have 3 arrays that'll be chosen if an int is equal to a certain value (e.g. 1, 2 or 3)

#

I don't know if I can instantiate an array with built in values

slender nymph
#

use collection initializer syntax

spiral glen
slender nymph
#

google it

spiral glen
#

that might work

spiral glen
#

arrayPlacement(1,2,1,comboChoice[]);
if I make a function that requires the input of an array would I implement it like this?

#

(comboChoice[]) being the array

polar acorn
raw token
# jaunty wedge I'm just curious whether using coroutines would be a better solution to this

Coroutine iteration will be the same as your framerate, so it may be better or worse than Task.Delay() depending on the platform and framerate...

But since you can't really change your visuals faster than the framerate anyway, I would think to decouple the telegraph and the attack, and spawn each as close to their respective beats as possible. If you modify them such that you can set their states to specific times, you could immediately update each right after they're spawned in order to compensate for the delay between the frame and the beat - this way the animations and such should still be dead-on with the beat, and in the very worst case the player will miss out on one frame's worth of animation/effects

spiral glen
#
        ar[0] = a;
        ar[1] = aa;
        ar[2] = aaa;
    }```
#

mb should of included this

#

I'm having an error when inserting the array into the function

#

where it says I need to add a ;

verbal dome
#

You dont add [] when calling the function

polar acorn
spiral glen
#

oh ok

#

thanks

wanton kraken
#

hey fellas. i've recently added some code to my game that runs upon firing a bullet. it's meant to pull the correct variable from the bullet prefab, and then add that force as relative force on the player. everything is set correctly in the inspector, debugging shows me that it's pulling the correct variable from the bullet, the code is definitley running, and no matter what number i use, no force is being placed onto the player. any ideas?

#
        if (hit.collider == null)
        {
            Vector3 spawnPosition = transform.position + transform.up * 0.5f;
            GameObject bullet = Instantiate(CurrentBullet, spawnPosition, transform.rotation);
            Vector3 knockbackDirection = -transform.forward;
            PlayerRB.AddRelativeForce(knockbackDirection * CurrentBullet.GetComponent<Bullet>().BulletKnockback, ForceMode2D.Impulse);
        } else {
            deny.Play();
        }
verbal dome
wanton kraken
#

nope, player movement works by adding relative force as well

#

that was my first thought lol

#

damn. got no idea!

raw token
wanton kraken
#

it's on the BulletSpawn object, a child of Player which acts as an invisible point to fire bullets from

#

everything works fine, and i can't see why the knockback portion isn't working. quite odd

#

anyone have an idea?

stuck palm
#

how can i make my own version of ontriggerenter and oncollisionenter that would work the same way? like i just put it on anything with my own custom collider and it will send the message accordingly?

public void FixedTriggerEnter(FixedCollider other)
    {
        
    }
    
    public void FixedCollisionEnter(FixedCollider other)
    {
        
    }
polar acorn
raw token
stuck palm
#

can i send out a message or something?

wanton kraken
polar acorn
#

But it's fairly slow, since it attempts to call that function on every behaviour on the object

wanton kraken
#

you're the best dude, that was it. i really had no clue, thanks a bunch

polar acorn
#

If you could do a TryGetComponent and call it directly it'd be better

slender nymph
#

use an interface rather than a specific component and you'll be able to implement it on any component

stuck palm
slender nymph
#

yep

stuck palm
#

okay, will try this

#

so like

#

TryGetComponent Icollisionreciever . OnTrigger

rocky canyon
stuck palm
#

within my simulation manager?

rocky canyon
#

not sure exactly how to do it w/ triggers i use a raycast but thats the TryGet w/ an interface

stuck palm
#

okay

#

thank you!

slender nymph
#

just note that unlike using SendMessage which attempts to call the method on every monobehaviour on the object, TryGetComponent will only get the first component with that interface that it finds

stuck palm
#

cus some things would have multiple colliders

polar acorn
#

This might be the one use case where SendMessage is actually preferred over manually getting the component

stuck palm
#

probs

#

i'll do that then

#

how does it work for ontrigger again?

#

only one has to be a trigger for it to be a trigger collision

polar acorn
#

You'd just call SendMessage on an object and it'll call the function with that name on every behaviour on the object

slender nymph
#

i'm curious what the purpose of all of this is. if you're just replicating how unity's physics already works, why not just use that? 🤔

stuck palm
wanton kraken
#

my code for knockback should be applying force correctly. it's -transform.up, so it should be in the direction opposite to what the player is facing, instead, when the player is facing downwards, this pushes the player downwards as well. any ideas?

raw token
wanton kraken
#

you've done it yet again, dapper racoon. you are truly a light in the deep darkness of C#

#

thanks a bunch 🙏

ember tangle
#

are there any negative consequence from making a vector 3 nullable? Vector3? foo

polar acorn
#

Other than all of the annoyances that come from dealing with nullable types in general, probably not

summer stump
#

Try using a Vector3? somewhere expecting a Vector3 and let us know if that is a negative consequence

ember tangle
#

I cant use Vector3.zero and the easiest solution I can think of uses a null value

ember tangle
slender nymph
stuck palm
#

if i make something readonly how am i ever meant to set the value?

slender nymph
#

you would create a parameterized constructor to assign the values

stuck palm
#

right, thanks

polar acorn
#

and you need to check and unpack the value

ember tangle
#

a Vector3? click is assigned hit.point from ray cast against a terrain so long as the player clicks within the 'map bounds.' If the player clicks the terrain outside of the map bounds, a null value is set and a null check stops the command from being issued. Its the only Vector3 that needs to be nullable.

steep rose
#

also bawsi im sorry if i was being a dingus earlier

eternal needle
eternal needle
slender nymph
steep rose
rich adder
#

yea nullable overkill here

eternal needle
#

I could see it being useful if you're making some public vector3 and someone else was using this code. But in my own code I've never felt like I needed or wanted nullable

ember tangle
#
{
    click = hit.point;
    Debug.Log($"click = {click}");
}
else
{
    click = null;
    Debug.Log($"click = {click}");
}```
slender nymph
#

you're not really providing enough information about why that bool or the nullable Vector3 are even necessary

slender nymph
#

what is the point of assigning a variable and doing the checks elsewhere?

ember tangle
#

hmm... when you put it that way

slender nymph
#

remember the KISS principle. don't overcomplicate things

ember tangle
#

yeah lol why would I ever not just check BattleMapManager.Instance.battleBounds.GetComponent<BoxCollider>().bounds.Contains(hit.point) instead of changing all these classes to accomodate a nullable Vector3. Damn.

slender nymph
#

or if the point is for other objects to be notified when a valid click happens, just invoke an event in that if statement intead of polling the check variable

summer stump
primal trench
#

how do i make an array?

#

a variable which is an array

teal viper
mint remnant
#

int[] a;

primal trench
teal viper
primal trench
#

also my problme is i have an array
Perk[] PerkArray = {};
but i cant refrence "PerkArray" later on in the script

primal trench
#

i was getting impatient and bored

teal viper
mint remnant
#

try a List instead, probably simpler to understand

teal viper
#

You'll need to share more of the code

primal trench
mint remnant
vapid yew
#

My character controller is Jesus. It defies the laws of Move() and gravity despite being !isGrounded.

Annoying problems:

  • The radius is set perfectly for my game world. Can not make smaller.
  • I can not change the skin width otherwise the controller susceptible to friction slow falling when hugging a wall.
  • I do not want the player to be able to traverse > 60 deg angled slopes.
teal viper
primal trench
# teal viper This is also probably due to missing the C# basics

i checked microsofts documentation and in theory i should be able to do

PerkArray.Add(Whatever);

but if i try and do that it shows Perk array being non-existent
this is within a public class serializable class, which is in a public static class
I can show full script if needed
i checked the docs and that should work

vapid yew
#

You can see in the camera mini-view the player is visually well overextended.
I believe the Capsule collider is getting stuck on the curved edge as seen in the wireframe view.

#

@teal viper What part?

teal viper
primal trench
#

not an array

#

woops

#

the first peice of code is

#

List<Perk> PerkList = new List<Perk>();

#

this is the same as shown on microsoft's docs except instead of string im using my class, Perk

teal viper
eternal falconBOT
vapid yew
primal trench
teal viper
primal trench
#
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class Globals
{   
    public class Perk
    {
        string name;
    }

    [Serializable]
    public class Perks
    {
        List<Perk> PerkList = new List<Perk>();
        PerkList.Add(Perk);
    }
}
#

there's also some other errors but they are related to perklist not existing

teal viper
#

And you can't add types to a list

teal viper
#

Unless it's a list of types.

primal trench
#

yeah

#

I'm coming from godot so I'm used to you being able to make that kinda thing

vapid yew
#
void Update() {

    // Check if player is grounded
    groundCollisions = Physics.OverlapSphere(groundCheck.position, .4f, groundMasks);
    if (groundCollisions.Length > 0 && velocity.y < 0) velocity.y = -2;
    
    // Movement controls
    Vector2 movement = playerInput.Movement.Movement.ReadValue<Vector2>();

    Vector3 move = transform.right * movement.x + transform.forward * movement.y;
    controller.Move(move * movementSpeed * Time.deltaTime);

    // Landing
    if (!isGrounded && !isPlayingSFX && Physics.CheckSphere(groundCheck.position, .4f, groundMasks)) {
        // Land shit
    }
    
    if (groundCollisions.Length > 0) {
            isGrounded = true;

            // Dynamic movement speed
            movementSpeed =  isCrouching ? 2.5f : isSphereGrounded ? 5 : 6;

            // Jump
            if (playerInput.Movement.Jump.IsPressed() && !isJumping) {
                isJumping = true;

                velocity.y = Mathf.Sqrt(jumpHeight * -2 * -19.62f);
            }
        }

    // Apply gravity and move player with bridge 
    velocity.y += -19.62f * Time.deltaTime;
    controller.Move((velocity + externalVelocity) * Time.deltaTime);
    externalVelocity = Vector3.zero;
}

@teal viper Here's the abridged version

primal trench
#

and in gdscript u can make a list equivelant

#

and im used to u being able to add methods (or functions) to them

teal viper
primal trench
teal viper
vapid yew
#

I'm telling you it is the character controller capsule collider itself getting stuck on the ground whenever the collider begins to curve.

#

If I disable my PlayerControls class the fucking wise guy just hovers there

slender nymph
#

well yeah, the CharacterController does not have built in gravity

long vortex
#

sup

vapid yew
#

@slender nymph Wait a second you're right

slender nymph
#

i usually am

zenith cypress
#

You only get gravity with a CC by default if you use .SimpleMove(speed)

vapid yew
#

Well hang on then

mint remnant
#

@primal trench also think about what you're attempting to do there, a container of Perks inside hte Perk class, you add a perk and it too has a container of PErks too now. Typically a container goes outside of the class that it wants to contain

long vortex
#

`void Update()
{
touchin = Cd.touchin;
if (touchin == true)
{
questbeing.SetActive(false);
fatbeing.SetActive(true);
fatsurround.SetActive(true);
fattext.text = "isudfhisuf";

    }
    if (Input.GetKeyDown("q"))
    {
        Debug.Log("q was pressed");
    }
    
}`
slender nymph
#

three back ticks, not just one

vapid yew
#

Regardless of your point @slender nymph The guy's still hovering.

#

The PlayerControls and gravity are enabled

#

Yet that small enough lip is enough to carry his entire weight

devout flower
#

is there a way to reset gizmo settings?
i'm drawing a sphere but it's turning out as an oval

slender nymph
long vortex
#

so basically my problem is when the first if statement is done even once, the second just doesnt work almost like its stuck in the first if statement, even if its condition isnt met anymore

vapid yew
#

He's not hovering "above" he's hovering over the edge. He should be falling.

#

Yet that tiny contact point on the edge of the capsule collider is enough to hold the entire player up

slender nymph
#

the CC's capsule collider has absolutely nothing at all to do with your ground check since you do that manually with the OverlapSphere

#

use the physics debugger to visualize your overlap sphere so you can see how large it actually is

vapid yew
#

The player is NOT grounded when this issue occurs

#

If I position the player any further over the edge the built up velocity from "free-falling" shoots me down

slender nymph
#

then your capsule is too wide or your ground check sphere is too small. they should have the same radius considering the CC's collider coming into contact with any object during its downward motion will stop that motion. just like any collider that is large enough (in any way) to be in front of it at all when you move forward would stop it

#

and of course you have to consider the skin width of the CC for collisions

vapid yew
slender nymph
#

the only reason you gave for the skin width was related to how you do your ground check and apply gravity

vapid yew
#

Changing the skin width does not effect the results of the issue. I have tested with above, below and equal to 10% of the radius.

slender nymph
#

okay well at this point i've explained why your issue happens. so you can either correct it or not 🤷‍♂️

vapid yew
#

My capsule and ground check radius are not incorrect. I have tested this.

#

And yes I consider skin width in the positioning of the ground check

slender nymph
#

well then i'm happy to hear you don't have an issue

primal trench
teal viper
primal trench
#

sorry for being stupid to u :p

slender nymph
#

sure, but again if there is any collider that the CC can collide with below the CC when it moves downward and its collider would collide with that (taking into account its skin width as well, meaning your CC is effectively 0.58 units wide, not 0.5) that will stop it from moving downward

#

i genuinely do not know how i can be more clear about that, colliders in its way stop the CC from moving because that is what the CC is meant for

round plover
#

having trouble dragging my text script into my score text so it would show me the position of my cube the further it goes but it wont let me drag it and put it in there

rich adder
round plover
#

what do you mean

#

yeah server wouldnt allow me to send bigger photos

rich adder
round plover
upper tide
#

If Action is the void return type of delegate, do event delegates exist since event actions exist?

round plover
#

it wont let me drag it into there

rich adder
#

Do you see It says Text

round plover
#

yess

rich adder
#

yours says TextMeshPro UI