#💻┃code-beginner

1 messages · Page 201 of 1

mild osprey
#

See, something I wasn't aware of lol

swift crag
#

okay, so this is Visual Studio

rich adder
hexed terrace
#

!vs

eternal falconBOT
#
Visual Studio guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

mild osprey
#

This is just what I went off of a youtube video as one option

swift crag
#

drums tried to configure the code editor already and had a problem

cosmic dagger
# mild osprey

ok, now compare this to the unity/youtube code to see where you went wrong . . .

mild osprey
rich adder
summer stump
#

If MonoBehaviour (and all those types) is white, it is not configured
(Unless you forced it to be that way in settings)

mild osprey
#

Alright time for me to go fix some stuff.

summer stump
noble summit
#

make sure preferences -> external tools has the correct version

swift crag
#

You said something about the choice of script editor resetting.

toxic frigate
#

Lessgo the SO works now UnityChanCelebrate

mild osprey
#

The script?

swift crag
#

this would be a screenshot of Visual Studio

#

showing that you have the Unity workload installed

#

this is described in the instructinos

summer stump
mild osprey
night sparrow
#

Could anyone help me Im not sure if this a code Issue or something else, my Player seems to just fall through the map since using Pun 2 Networking and setting it up!

Not sure if i have done something wrong with player or what

summer stump
night sparrow
polar acorn
summer stump
polar acorn
#

Note that a CharacterController is a collider

toxic frigate
#

prolly a dumb question but 2 SOs can have the same order right (since its kinda just priority level of execution)

night sparrow
summer stump
#

So you removed the collider and added gravity. Seems a clear cut case here

toxic frigate
swift crag
#

This has nothing to do with execution order

#

It controls where they appear in the Create Asset menu

toxic frigate
#

ohhhhh

swift crag
#

you can find this out by reading the CreateAssetMenu documentation (:

toxic frigate
#

mb then

toxic frigate
#

I was skimming through the SO section on their website so must've missed it

#

mb

#

Different filename, menuname and order, what exactly is being duplicated here between 2 different SOs thinksmart

swift crag
#

none of those matter at all

#

the only thing that matters is the class name

#

the C# compiler doesn't care about the attribute at all, and filenames are also irrelevant

#

you can have 1,000 classes whose CreateAssetMenu attribute all give them a menuName of "Foo"

#

it'll compile just fine

toxic frigate
#

i see

mild osprey
#

But I'm already going back through the steps

#

Just sending you thiose anyways

summer stump
# mild osprey

Ok, you didn't show the workload though
The workload is where you get the Unity "extension" (not called that in VS) inside Visual Studio

swift crag
#

how do you pull that window up if you installed VS through the Hub?

#

it looks like the instructions say to open it with the installer, which isn't relevant in that case

#

I don't use VS so I don't know off the top of my head

summer stump
#

It's been a while, can't remember honestly

#

Maybe it actually says Get Extensions?

languid gyro
#

idk how to use this api

swift crag
#

you should probably read the Game Jolt API documentation, then

#

It looks like this is a component that has a single UnityEvent on it

#

which will fire upon...auto login!

#

presumably when the player is automatically logged in to something

mild osprey
toxic frigate
#

this is gonna be a dumb asf error but

SO1:


[CreateAssetMenu(fileName = "EntityConfigs", menuName = "Configs", order = 1)]
public class SpawnManagerScriptableObject : ScriptableObject
{

    [field: SerializeField] public float PlayerForce { get; private set; }
    [field: SerializeField] public float ObsSpeed { get; private set; }
    [field: SerializeField] public float ProjSpeed { get; private set; }
    [field: SerializeField] public float ObsDeadzone { get; private set; }
    [field: SerializeField] public float ProjDeadzone { get; private set; }

}```

SO2:
```using UnityEngine;

[CreateAssetMenu(fileName = "EntityStats", menuName = "Stats", order = 1)]
public class SpawnManagerScriptableObject : ScriptableObject
{

    [field: SerializeField] public float maxhp { get; private set; }
    [field: SerializeField] public float minhp { get; private set; }

}```

Error:
Duplicate 'CreateAssetMenu' attribute

what is the duplicating CreateAssetMenu attribute between the 2
rich adder
swift crag
#

again, the class names are the same

#

they're both called SpawnManagerScriptableObject

#

so you have two [CreateAssetMenu] attributes on a class named SpawnManagerScriptableObject

#

hence the error

rich adder
swift crag
#

you'll need to point drums to that window, then

rich adder
#

its part of the guide

swift crag
#

the instructions cover how to open it when installing VS manually

#

they do not tell you how to open it if you aren't using the VS installer

mild osprey
#

But he said in Extensions in VS right?

swift crag
#

Did you install VS manually?

rich adder
swift crag
mild osprey
#

Drums is trying to walk before he crawls 😬

swift crag
#

i dunno

toxic frigate
mild osprey
toxic frigate
#

thanks for bearing with me lol

swift crag
swift crag
languid gyro
#

what's the next step for the Gamejolt UI?

swift crag
#

most people here aren't going to know how the Game Jolt API works

mild osprey
#

Ok, brains working now

swift crag
languid gyro
#

ok hold on

rich adder
swift crag
#

there's one really goofy problem you might be having

mild osprey
#

I haven't checked anything else since install

swift crag
#

sometimes VS just turns off the project

#

i believe you want the "Solution Explorer" window

rich adder
swift crag
#

the old VSCode extension is installed, but that shouldn't matter

mild osprey
rich adder
#

2019 😬

rich adder
#

screenshot the whole VS including Solution Explorer

swift crag
#

this is the "turning it off and on" part of the diagnostic

mild osprey
polar acorn
mild osprey
#

On VS or Unity?

rich adder
mild osprey
#

Oh.

rich adder
#

If it doesnt work after that and opening script, then in Solution Explorer def holds the issue

night sparrow
#

-- removed

rich adder
night sparrow
#

mb sorry!

mild osprey
#

Mother of God

hexed terrace
#

what?

mild osprey
#

My code imploded

hexed terrace
#

right, because you made a silly mistake

mild osprey
#

I'm sure I did I've been trying to fix my booboo

rich adder
#

well at least now its configured

hexed terrace
#

you seriously can't immediately tell what you did wrong?

mild osprey
rich adder
#

member variables must be declared INSIDE a class

#

also wttf is -500 for

hexed terrace
#

reverse speed!

rich adder
#

going zoooooom

mild osprey
# rich adder also wttf is `-500` for

Idk, was just doing what one video suggested. Was trying to remember how to make it spin without looking up any hints, got stuck, started from scratch and watched the first youtube video to at least try

rich adder
#

probably want to use Time.deltaTime for consistency through different FPS

slender nymph
#

what you don't want to rotate 500 degrees per frame?

mild osprey
swift crag
#

Anything in Update will execute once per frame.

#

So, you should keep that in mind when deciding how much rotating to do.

mild osprey
#

jk

swift crag
#

Imagine that the game is running at 100 frames per second

#

How many degrees should you rotate per frame to rotate at 500 degrees per second?

mild osprey
swift crag
#

Yes.

#

You're going to be doing a lot of math.

mild osprey
#

I know. Unfortunately. I'm getting ready to take some college classes soon for Math

rich adder
swift crag
#

This is a middle-school algebra problem.

#

so, how many degrees per frame?

mild osprey
mild osprey
rich adder
swift crag
polar acorn
mild osprey
mild osprey
#

I'm sure this stuff should be easier than how I feel right now. Once I actually get the hang of it though I'll remember how to fix my errors

swift crag
#

no, that would be for 60 frames per second

#

i specified that the game was running at 100 fps

#

wrong direction

#

500 divided by 100 is 5.

mild osprey
swift crag
#

500 degrees per second. 0.01 seconds per frame.

#

500 * 0.01 = 5

#

Multiplying 500 by Time.deltaTime will give you how far to rotate in each frame. Time.deltaTime is how long the last frame took to render.

#

At 100 frames per second, Time.deltaTime is 0.01, because each frame takes 0.01 seconds

#

Since your framerate will be varying, Time.deltaTime ensures that you rotate by the correct amount each frame.

mild osprey
#

Ok well I fixed all the code errors but propeller is still not spinning so going back over it and figuring that part out

rich adder
mild osprey
#

Also I assume there's other better ways to learn all this lingo and terminology than Unity Learn? I don't want to limit myself

earnest atlas
#

I want to check for enemy aggro, I think of adding a sphere with OnTrigger that is set to player layer and check OnTriggerEnter to check if enemy should be in aggro state.

Or should I do it with Physics.SphereCast() that is run in corutine every few seconds?

sweet osprey
rich adder
#

if you do use SphereCast , always opt for -nonalloc

earnest atlas
mild osprey
#

It does in fact print "Hello World"]\

#

ahh silly fingers

pine bone
#

Hello, how can i make 2 child objects teleport to the same position? I have an attachment system where the player can connect attachments together. I want to set 2 attachments to the same position and rotation while the parent follows it

slender nymph
rich adder
#

but I thought you want to check aggro, then use physics queries

#

just use nonalloc

earnest atlas
#

Im already doing one direction check to make a raycast that works as LOS trigger. Might as well before normalizing the vector calculate distance

#

Enemies are not in the list only player is. I get get player position and enemy position and just calculate the distance.

#

I have NavMechAgent thing. Maybe it has some implementation already?

grave forge
#

i need heeelp

astral cedar
grave forge
#

so i tried to do an fps game but camera dosent work

upper sphinx
#

How are you setting up the camera

grave forge
grave forge
polar acorn
grave forge
#

so my camera is there but its not fps yknow

rich adder
#

I'm kinda lost now lol

polar acorn
pine bone
upper sphinx
#

@grave forge so you want your camera to look around with the mouse or what you mean exacltly

polar acorn
grave forge
pine bone
swift crag
earnest atlas
polar acorn
devout flume
#

!vscode

eternal falconBOT
#
Visual Studio Code guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

https://on.unity.com/vscode

lusty girder
#

Why might the player rotation code under //Rotation work perfectly fine with AddForce but not with AddRelativeForce?
When 'AddRelativeForce' is used (_rigidbody.AddRelativeForce(_playerCalculatedForce, ForceMode.Force); in conjunction with the code under //Rotation, the player rigidbody starts moving in random directions.

private void FixedUpdate()
    {       
        _playerMoveInput = moveDirection;
        _playerCalculatedForce = _playerMoveInput; 
        _playerCalculatedForce = _playerCalculatedForce * _movementMultiplier;
        _playerCalculatedForce *= _rigidbody.mass; 

        _rigidbody.AddRelativeForce(_playerCalculatedForce, ForceMode.Force);
        //_rigidbody.AddForce(_playerCalculatedForce, ForceMode.Force);

        //Rotation
        if (MoveIsPressed)
        {
            targetRotation = Quaternion.LookRotation(moveDirection); //or moveDirectionRaw
            targetRotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotDegPerSecond * Time.deltaTime);
            _rigidbody.MoveRotation(targetRotation);
        }
    }

Full movement script (it is pretty small):
https://hastebin.com/share/abalotunan.csharp

earnest atlas
#

Agent has the code to chaice. I need distance and LOS chrcks

upper sphinx
#

@grave forge Unity has an FPS template already built-in into the Hub

swift crag
#

and AddForce works in world space

earnest atlas
#

There is unity asset pack

grave forge
#

well time to delete my project i guess

earnest atlas
#

That comes with FPS controller

swift crag
rich adder
earnest atlas
grave forge
#

wait where is the template at

lusty girder
astral cedar
swift crag
swift crag
#

the problem with using AddRelativeForce instead of AddForce is that your input is being interpreted in a different coordinate space

swift crag
#

this has nothing to do with using MoveRotation to change your rotation

verbal dome
swift crag
#

well, other than the fact that changing your rotation changes the meaning of a local-space vector

upper sphinx
#

@grave forge Sent you image in DM

earnest atlas
pine bone
# polar acorn You can set rotation too. And parents don't "follow" child objects, other way ar...

thats what im asking, the attachments are inside the model.

public void ConnectTo(Attachment attachment)
{
    occupier = attachment;
    attachment.occupier = this;

    baseObject.transform.rotation = Quaternion.Inverse( transform.rotation * attachment.transform.rotation);
    Vector3 offset = attachment.transform.position - transform.position;

    baseObject.transform.position += offset;


}```

This is my current script, it didnt originally change the rotation but since i'm adding the ability to switch between attachments while building i needed it.

Look at the image, think as if the boxes are the main objects and the arrows are the attachments facing out. How can i always make sure the attachments are at the same position and facing each other (While changing the parent position too)
shell sorrel
#

that code will do amost nothing

polar acorn
# mild osprey

That would log the value of your unused, unnecessary value

shell sorrel
#

will rotation by a fraction of speed once and only once

mild osprey
#

Well I was just told to debug and check so I can see why my propeller still isn't spinning

swift crag
#

here's what you want to do:

rich adder
shell sorrel
#

you need the rotation code in Update

polar acorn
mild osprey
rich adder
# earnest atlas And how exactly that works to make Fov?

Download the Source - https://game.courses/dot/

Determine if an object or character is in front of another, seen by it, or behind it in Unity3D with this simple 2 line c# script. Discover the power of Vector3.Dot and how to use it in a few seconds to make your AI better.

Architecture Course - https://game.courses/architecture/
Become a Member ...

▶ Play video
toxic frigate
#

spent today's session setting up SOs for my gameobjects' stats and configs, truly a rabbit hole ngl
the urge to turn every static value into a SO UnityChanCoder
tomorrow imma move forward with the buffs system using SOs hopefully wont be as taxing as today

earnest atlas
polar acorn
timid hinge
#

Hi, does anyone know how to place the dungeons with the straight walls forming a square

lusty girder
earnest atlas
pine bone
earnest atlas
nimble hinge
swift crag
#

had to rename everything

polar acorn
swift crag
#

The rough idea is that you calculate the offset between the parent and the child objects.

earnest atlas
#

Oh I think I understand

swift crag
earnest atlas
#

No i dont 😦

rich adder
swift crag
#

root is parented to handle, so it moves as well

#

Then we move the parent to where root is

#

Since root and handle still have the same offset they began with, the child now winds up exactly at handle

#

here, let me show you the context I used this in

#

I used this to attach a ragdoll to a joint.

verbal dome
swift crag
#

I have to teleport the root of the ragdoll such that the Rigidbody I care about winds up exactly at the Joint's position and rotation.

earnest atlas
#

Oh funy enough I understood it

pine bone
swift crag
nimble hinge
#

transform.up?

#

Or you could use Rigidbody.Rotation

swift crag
#

(the parent can be a grandparent, too, or anything further out)

earnest atlas
#

(vector-vector2).Normalize
Same as result of the opearation.Normalize?

verbal dome
grave forge
#

guys why dont i have 1st person templates in unity hub

earnest atlas
swift crag
grave forge
#

ok ill install the other version

swift crag
verbal dome
swift crag
#

but later; i need to get to work :p

pine bone
nimble hinge
#

this is the difference using normalize and not using it

lusty girder
nimble hinge
#

right one shows normalize, you're trying to achieve

verbal dome
#

Yeah physics takes some math. But you don't have to really do trigonometry, just learn what the Vector3/Quaternion functions do

nimble hinge
#

And first one is around 1.4, because of pythagoras theorem

nimble hinge
#

for converting mouse position in world space

rich adder
#

not necessarily

swift crag
nimble hinge
#

But it depends too

swift crag
#

Vector3 and Quaternion are really handy

nimble hinge
#

It's not that needed

devout flume
#

Can I use a monoscript like a standard class? By that I mean:

namespace test {
  public class Test {
    //Fields

    public Test() {

    }

    public Test(...) {

    }

    public ... get() {
      return ...;
    }

    ...
  }
}
```?
shell sorrel
swift crag
#

Or do you just mean a script file that defines a plain old C# class?

#

This looks like the latter.

devout flume
swift crag
#

Test is not "a monoscript". It is true that it's defined in a file that unity imports as a MonoScript asset, but that has no bearing on what Test is

#

Test is a class.

#

and since it doesn't derive from UnityEngine.Object, Unity doesn't really care about what you do with it at all

#

so yeah, you can do whatever you want with it

devout flume
#

So I can't define my classes and use them in other stuff?

swift crag
#

Of course.

devout flume
#

Oh, so I can

nimble hinge
#

The namespace you defined, can be used

languid spire
#

yes, as long as the do not inherit from Monobehaviour

devout flume
#

Yes, I kinda see the transition between java and C#

swift crag
#

Unity starts getting upset if you try to construct something like a MonoBehaviour or ScriptableObject.

devout flume
#

I was quite surprised on the similarities C# have with java

earnest atlas
verbal dome
swift crag
swift crag
#

I despise the "i'm just dumb and i'll never understand math" mindset

#

Stop putting yourself down

nimble hinge
#

you know coordinate system right?

pine bone
verbal dome
shell sorrel
earnest atlas
#

I went math heavy route at school

#

I just dont understand them

swift crag
#

Look at the first script. I made the names generic there.

#

The second script is there to show you a place where I used that logic.

pine bone
swift crag
#

oh! my bad

verbal dome
nimble hinge
#

but just in case, you can use that too

verbal dome
#

True

swift crag
#
Transform what = ...
what.transform.position = Vector3.zero;

I do this way too often.

#

transform.transform.transform.transform.transform.transform.transform.transform.transform.transform.position = ...

verbal dome
#

transform does have some overhead

#

So if I have a method where I would call transform 10 times I just cache it (especially in Update/FixedUpdate)

#

And yeah readability

pine bone
mild osprey
swift crag
#

If it's 2D you can probably just multiply by Quaternion.AngleAxis(180, Vector3.forward)

pine bone
swift crag
#

It copies the rotation of the destination transform.

pine bone
#

i reversed the rotation and it worked thanks

#

oh wait it didnt

gray pond
#

would somebody mind helping me out quick? got this error after following a tutorial to make a dash

#

what would this error mean?

#

i can link the code on a pastebin

summer stump
gray pond
#

ok that's a start

pine bone
gray pond
swift crag
#

great avatar-message combo here

rich adder
meager steeple
#

instead of setting fullscreen to true when im changing resolution, i want it to stay the same as what it was, what do i change "true" to be?

slender nymph
eternal falconBOT
rich adder
polar acorn
rich adder
#

maybe its VS2017 theme 😛

slender nymph
#

pretty sure types would still have syntax highlighting with that

meager steeple
gray pond
meager steeple
#

maybe it didnt load

slender nymph
rich adder
#

also - references is concerning

#

def not configured then

meager steeple
rich adder
slender nymph
gray pond
#

would these be the same thing or do i need to make a variable called _rigidbody.velocity

meager steeple
#

right it was set to 2019

#

once i set it thats all i have to do?

polar acorn
rocky canyon
short hazel
meager steeple
#

3 people pinging the same thing but no one gonna say anything else

slender nymph
#

then surely you know that there is more than just a single step

rocky canyon
#

whenever u reference it (_rigidbody) ur actually referecing the RIgidbdoy2d

gray pond
#

i need to make a value

short hazel
#

You need to put a value in the variable yes

#

Otherwise it's at null by default

gray pond
#

ahh silly me

#

ty bros

summer stump
meager steeple
summer stump
slender nymph
meager steeple
#

✨ syntaxes

slender nymph
#

there you go. wasn't reading and following the directions so easy?

meager steeple
#

so will you help me now or not

gray pond
#

ah sorry i can't figure out how to add the variable for my rigidbody.velocity

slender nymph
short hazel
rich adder
meager steeple
rich adder
ivory bobcat
meager steeple
rich adder
meager steeple
#

that would take me even longer

rich adder
#

sure exporting an empty scene with a few scripts longer alr

spiral narwhal
#

How do I "update" OnPointerEnter?

In my game, if I'm hovering over a card, it shows a detailed view explaining what the card does. It only does so, however, if no card is currently selected.
Therefore, in OnPointerEnter, I return out of the method if that bool is true. If I click right click, the selection stops, which works great, but here's the issue:
If the user hovers over a card whilst the lock is active, then right-clicks to remove the lock, the card is not considered "hovered" because right now, I'm not alerting Unity that it should re-evaluate OnPointerEnter. Hope that made sense

rocky canyon
#

u need to keep up with the cards u have currently selected

swift crag
rocky canyon
#

then u can change the functionallity of what clicks/ hovers do depending on if that card is selected atm

dire tartan
#

if ive got an animation and its set with a bool and once that bool is true i want the animation to finish even if the bool is set to false during the animation what setting is it to do that

meager steeple
dire tartan
#

thank you

spiral narwhal
rocky canyon
#

oh, unsure about that oen

spiral narwhal
#

Ok

rich adder
#

there are other events

#

but idk what the usecase is exactly

short hazel
#

OnPointerEnter, set bool to true. OnPointerExit, to false. In Update check that bool and run code each frame if it's true

spiral narwhal
#

But Unity does not update OnPointerExit and Enter if I don't leave the GameObject with the mouse

#

I will post a Gif if that's allowed

spiral narwhal
#

Well yes I was referring to that

swift crag
#

okay, so do your work somewhere else

#

like, say, Update

#

OnPointerEnter tells you when the pointer enters the object. That's it.

#

It would be useless if it ran at any other time.

slender nymph
#

and you could even do something like flip a bool in OnPointEnter/Exit to tell Update when it needs to do the work

spiral narwhal
#

So here you can see that when I right click to remove the "lock" OnPointerEnter is not called because I have not left and re-entered the object

gray pond
#

ah ok, i've figured out why i couldn't dash but now i can't move my player character, and when i want to dash it only goes up if i press up on my keyboard and dash

swift crag
#

yes, which is why you shouldn't use OnPointerEnter to move the card

#

you should just use it to set a boolean to true

#

somewhere else, you can use that boolean to decide what to do

spiral narwhal
#

Oh I think I understand. So the objects always no whether or not they are being hovered over?

#

No matter the lock

#

know*#

gray pond
#

i typed the issue at the start

slender nymph
spiral narwhal
#

So if I click on a card it is considered "locked", so other cards cannot be hovered over if one has been clicked

slender nymph
#

and that sounds like an issue with your logic rather than how the event system interfaces work

spiral narwhal
#

Hm I suppose

swift crag
#

use OnPointerEnter and OnPointerExit to do nothing other than set a boolean on the card

#

decide how to position the card based on that boolean and whatever else you care about

rocky canyon
slender nymph
trim gulch
#

Hello. Is it possible to make a Rigidbody ignore collisions with another one based on a tag or something like that? I have a 2D game where the enemies shoot, the bullets have their own rigidbodies, but I don't want them to collide with other enemies

spiral narwhal
rocky canyon
#

like maybe the jump is nested in an if else statement that has to be moving first b4 it gathers the jump.. not sure

swift crag
#

your computer is very fast

#

it will survive running Update 60 times per second on 15 cards

rich adder
#

oh wops

rocky canyon
#

you'll be able to disable any interactions between layers u wish

trim gulch
#

I guess that was too much of a begginer question, thank you all!

rocky canyon
#

nah, not at all

rocky canyon
#

it sounds that way

#

most jumps work independently outside the move functions.. when u jump u add a y value to ur overall vector

#

then when the move function runs, it just has the jump tacked in with it.. but theres other ways too

#

did u share ur code?

gray pond
#

there's a pastebin above

rocky canyon
#

let me lookie

gray pond
#

tyty

rocky canyon
#

ya, looks like ur only giving the rigidbody values if ur _isDashing

gray pond
#

ah fuck

rocky canyon
#

i dont see any velocity when ur not dashing for example

gray pond
#

ok i see, not sure how to fix that :(

#

ok let me try

rocky canyon
#

something like that

gray pond
#

well

#

two lines

rocky canyon
#

just an example.. u shouldnt replace anything w/ it

#

thats how errors happen.. and people not understanding their own code

ivory bobcat
#

Well, I guess you sort of are moving in FixedUpdate

#

Relative to some horizontal variable that is.

rocky canyon
#
       if (Input.GetKey(dashKey))
        {
            movementVector = input * dashForceMultiplier;
        }
        else
        {
            movementVector = input * normalForce;
        }```
then w/e you move ur rigidbody you have w/e value you need
```cs
        playerRigidbody.velocity = movementVector;
ivory bobcat
rocky canyon
#

this is what im meaning.. change ur values around as u need to.. then w/e u move ur rigidbody you'll have already set which values to use.. whether that be movement w/ a dash or movement w/o a dash

north scroll
#

whats usually the best/better method of implementing a simple movement mechanic for a 2d side scroller? Transform.position, rb.velocity, or addforce ?

#

and are there any others?

meager steeple
#

uh i never had this problem before when trying to close

slender nymph
north scroll
rich adder
north scroll
meager steeple
north scroll
#

i see, i think I know what u mean. When trying to use addforce, if I keep holding down the button, the addforce just keeps adding so... ty guys

slender nymph
scarlet skiff
sharp wyvern
scarlet skiff
slender nymph
#

you set the position when you spawn it to (0,x) and you do not assign to x so it's just being set to 0,0 until the next frame when that object's Update method runs

#

also why do you have a variable called x that is being used for the Y position of an object?

scarlet skiff
#

but when u mentioned x, thats for the laser shooter script, not the laser itself

#

its the laser that spawns at 0, 0 first

#

its supposed to spawn on the x value of the laser shooter

#

unless maybe it didnt count it as a local position

#

something like this i imagine?

faint sluice
swift crag
#

stop showing us tiny snippets of code

#

it makes it ridiculously hard to understand what's going on

#

share entire methods in

code blocks

or entire scripts in a paste site

faint sluice
ivory bobcat
swift crag
#

Fair enough.

faint sluice
swift crag
#

My mistake.

faint sluice
#

All good

dusk minnow
#

Image prefabImage = prefab.GetComponentInChildren<Image>(); i have an image attached to the object and to a child, i need the image from the child, how i do that

swift crag
#

I'm used to being shown tiny chunks of code that hide the actual problem 😅

languid spire
faint sluice
faint sluice
ivory bobcat
#

Scripts do not have positions.

scarlet skiff
#

yea thanks guys, i fixed it now

faint sluice
dusk minnow
swift crag
languid spire
#

even better

dusk minnow
faint sluice
#

I assumed it was instantiated prefab, so hard to get it

#

Can't pre reference it

swift crag
languid spire
#

put a script on prefab that holds a reference to the correct Image. prefab.GetComponent<ThatScript>().image

swift crag
#

or reference the prefab by that component's type, rather than GameObject

#

now you've got absolutely zero instances of GetComponent

#

for example, here's a pretty tiny example

#
public class InputActionIconPart : MonoBehaviour
{
    public TMP_Text label;
    public Image image;
}
#

(this class now has a bunch of actual logic, but I've removed that to match how it used to work)

#

all of the members are now private and you interact with it through methods

#

it's no longer just a "bag of data"

mild osprey
#

I forget if anyone answered me earlier about if there are other more efficient ways to learn coding and all the fundamentals and stuff besides just Unity Learn?

summer stump
#

And the pins here

languid spire
rocky canyon
#

go see Elon Musk, might be able to get in the Nueralink beta.. and get the programming knowledge downloaded str8 to ur brain

gray pond
#

hi peeps, just followed a tutorial to implement player movement 2d and a dash, but it only does horizontal dashes
how do i implement dashes for all directions? https://pastebin.com/q3Anx4TS

mild osprey
languid spire
#

knowledge is not even close to being enough, analyic ability, logical thought and pattern matching are things that are very difficult to learn

rocky canyon
#

instead of multiplying just the horizontal values with teh dash u multiply all the values by the dash

mild osprey
gray pond
gray pond
rocky canyon
gray pond
#

instead of horizontal

rocky canyon
#

"Horizontal" and "Vertical" are the two common inputs

#

WASD

mild osprey
rocky canyon
#

Vector2(x,y)

#

ur multiplying the vertical input with speed for the first value (x)

#

and then for the y value it seems ur just using the rigidbodies x velocity

#

w/e that may be..

#

x, y is normally flipped from how u have it 🤔 (horizontalInput * speed, verticalInput * speed);

#

or it could just be.. cs Vector2 myVector = (horizontalInput, verticalInput); myVector = myVector * speed;

polar acorn
rocky canyon
#

ya, it seems bass ackwards to me

#

but it could be just b/c of the way ur world is facing

#

like portrait vs landscape

rocky canyon
#

nope

gray pond
#

oof

polar acorn
#

And you cannot && two strings to get a boolean

rocky canyon
#

myVector = (Input.GetAxisRaw("Horizontal"),Input.GetAxisRaw("Vertical"));

rich adder
rocky canyon
#

&& is a comparison

gray pond
#

omg i'm getting dogged 😭

polar acorn
gray pond
#

lol

rocky canyon
#

new Vector2()

#

ahh yea i see

#
        float horizontalInput = Input.GetAxis("Horizontal");
        float verticalInput = Input.GetAxis("Vertical");
        Vector2 move = new Vector2(horizontalInput,verticalInput);``` is what i meant to say
rich adder
#

the other would've worked too one line if you just had added new Vector2

rocky canyon
#

thats just the basic input... after you grab that u do all the stuff like multiplying with forces and dashes and stuff

gray pond
#

this is rough

rocky canyon
#

lol.

rich adder
#

if you dont know basic c#

rocky canyon
#

it gets easier the more u do it.. but understanding what it is to begin with helps alot..

#

debug values, watch console logs, experiment etc

#

thats how u learn

#

and ofc reading/ studying

gray pond
#

https://www.youtube.com/watch?v=GhQdlIFylQ8 is this an ok tutorial for basic c#

This course will give you a full introduction into all of the core concepts in C# (aka C Sharp). Follow along with the course and you'll be a C# programmer in no time!

⭐️ Contents ⭐️
⌨️ (0:00:00) Introduction
⌨️ (0:01:18) Installation & Setup
⌨️ (0:05:03) Drawing a Shape
⌨️ (0:17:23) Variables
⌨️ (0:30:06) Data Types
⌨️ (0:37:17) Working With S...

▶ Play video
#

i had this bookmarked

rich adder
#

sure

gray pond
#

duality of man

rich adder
#

Giraffe is ok

rocky canyon
#

anything u expose urself to will be helpful..

summer stump
#

Immediate no whenever I see youtube haha

rocky canyon
#

maybe not the best.. but it cant hurt to see what its about

gray pond
#

i can't pay for courses because i have no money rn

summer stump
gray pond
#

so idk what else there is 💀

rocky canyon
#

no need to pay for courses..

rich adder
rocky canyon
#

free courses are a dime a dozen

#

just experiment.. learn.. DO

#

the most important one being the DO

summer stump
#

Literally good resources pinned to THIS channel

rocky canyon
#

if u fail, try again

rich adder
rocky canyon
#

learn why it failed.. and rinse and repeat

#

the pins are FULL of resources

rocky canyon
# gray pond so idk what else there is 💀

Welcome to this introduction to game development. We'll be starting from the beginning, so no prior knowledge of programming or the Unity game engine is required.

Unity can be downloaded here: http://unity3d.com/get-unity

Watch episode 01: https://youtu.be/9iCnjdXEfMA

If you'd like to support these videos, you can make a recurring monthly don...

▶ Play video
#

it gets ur foot in the door..

rich adder
#

hello wurld

#

hardcore mode : go straight into console apps.

gray pond
#

should i do both the microsoft one and the sebastian lague one

gray pond
#

like, microsoft first then sebastian

gray pond
rich adder
rocky canyon
#

do em both at the same time..

#

watch a video or two of the playlist.. then go over to text stuff and check out / read a little more context about what u just watched, etc

ashen wind
#

I'm trying to make a popup that occurs when the player mouses over something and I'm using OnPointerEnter and OnPointerExit to do it, but if I mouse over the UI object, it flickers on an off like enter and exit are consantly calling. I don't really understand why it's doing this

summer grove
#

does someone have to go through:
private float a
private float b

void start()
{
a = getComponentBoxCollidersize.x/2

void update()
if (blablbalbla... blablblabla. -725 a)
{
blablbalbal. b
}

this. when they can just measure the objects lenght and get the number then divide by 2 for free? (I know both work. I am asking optimization-wise)

ashen wind
#

anyone have any ideas for how to do this so it doesn't flicker?

rich adder
#

what does for free mean in this context , im so confused

gray pond
#

it's kinda annoying tho for me tho, i'm in my second year in college for game dev in the uk and i don't really know how to do anything game dev wise, and my final project is coming up so i'm kinda just grasping at straws 😭

summer grove
gray pond
#

yeah, i at least know what variables are, i think :3

rocky canyon
#

lol.. instead of sitting and telling us about how ur losing time.. use that time to be reading/ watching those videos

rich adder
#

or at least cache the component

#

GetComponent is pretty expensive in Update

summer grove
#

why

rocky canyon
#

GetComponent every frame is being mean to ur processor

summer grove
#

I have my project ready I am making adjustments

summer grove
rich adder
rocky canyon
#

cache it Once.. use the reference u cached the rest of the time..

rich adder
ashen wind
summer grove
rich adder
rich adder
rocky canyon
#

i honestly dont care, its ur project 🤣

rich adder
#

ur only hurting your on game's perfomance

summer grove
rich adder
rocky canyon
#

well there are.. so keep it going

#

maybe it'll build w/o flatlining

summer grove
ashen wind
rich adder
#

but yeah its your project do whatever

rich adder
#

what does OnPointerEnter DO in the script.

#

I know what function is

ashen wind
#

and turns it off when you stop mousing over

rich adder
#

then its blocking the raycast

#

untick RayCast target in TMP component's extras section

polar acorn
rich adder
#

its in an endless cycle, You enable it it blocks raycast and runs OnPointerExit then disables then blocker, Running OnPointerEnter again

#

rinse and repeat

rocky canyon
#

this is how u'd cache variables...

  • in the Awake() for example (Only runs once.. u get the component and set it)
  • then when you use it in Update or w/e you're getting the reference you already set.. instead of GetComponent every time..
summer stump
ashen wind
summer grove
#

How could there be downsides to measuring 33 game object's mesh's X value then diving by2 then writing manually 🤣

summer stump
ashen wind
#

there's a panel behind the button, but no other ui element overlaps

rocky canyon
#

use a bigger collider over the text.. and the text attached to it..

rocky canyon
#

using Text as the collider itself is terrible.. b/c u have to hover exactly over the little bits of the letters

rich adder
#

it will tell you exactly whats being Hit

#

if anything share script as well

ashen wind
#

the popup is blocking itself i think

#

i didn't think of that

#

yep that was totally it

swift crag
#

Yeah, that's a common error.

rich adder
#

niiice

rich adder
#

np!

rocky canyon
#

very useful 🙂

rich adder
#

Indeed! wow surpised you didnt know this one 😏

rocky canyon
#

i usually have that window collapsed

rich adder
#

yeah its not very obvious that can be expanded

rocky canyon
#

i only thought it was a preview window

#

for models and audio clips and whatnot

#

didnt even think of it displaying data like that

rich adder
#

Veryy handy for debugging !
back in the day I had no idea text objects also had Raycast bloking until I found this

rocky canyon
#

i did know that

#

b/c of the wireframe

swift crag
#

It can also display things like layout properties for RectTransforms.

halcyon summit
#

When I'm updating the colour of a UI material, UI elements inside a Scroll View aren't updating. Does anyone know how to force a Scroll View to refresh and adopt the changed colour?

swift crag
#

Very useful for understanding why your UI is doing whatever it's doing

swift crag
#

it just moves a RectTransform around

#

those graphics must have different materials

halcyon summit
#

They have the same material attached

rich adder
#

must be somewhere else then where you're not setting them properly

swift crag
#

perhaps you're instantiating the materials somewhere

halcyon summit
#

Every UI element adopts the new colour except the elements inside the Scroll View. The actual material itself is being changed

swift crag
#

hang on..."Scroll View"?

#

Is this UIToolkit?

swift crag
#

I was thinking of UGUI

rich adder
#

oh I thought also they meant ScrollRect

swift crag
#

ScrollRect is the UGUI component.

rich adder
#

this changes things then certainly, Uitoolkit is tricky with binding changes

swift crag
#

I haven't learned UIToolkit yet myself, so I can't say too much

halcyon summit
#

It's the element generated when choosing UI > Scroll View in the Hierarchy window

swift crag
#

Okay, so this is UGUI.

rich adder
#

oh then its the ScrollRect

swift crag
#

Do the colors change when you modify the material outside of Play Mode?

halcyon summit
#

Yeah

rich adder
#

How are you filling that Container ?

halcyon summit
#

Image

rich adder
#

are they instantiated

swift crag
#

i'm not sure how you'd put objects in a scroll view that aren't instances

halcyon summit
#

No, these particular ones are just individual objects existing on the canvas

swift crag
#

oh, I see what you mean

rich adder
swift crag
#

instantiated from a prefab, right.

#

facepalm continue

halcyon summit
#

Do you think using prefabs for them would help?

rich adder
#

but nvm

rich adder
halcyon summit
#

Sure

#

The top boxes are in the scroll view, I placed that single one below outside of the scroll view just to show that it works outside of it

swift crag
#

I wonder if your images are getting crushed down to 0x0 size

#

which could happen depending on how your layout group is set up and how the individual elements are structured

#

hm, but I'd expect that to happen outside of play mode, too

#

(and you'd need to have another image in each element, or else the element would just be completely invisible here)

halcyon summit
#

Does it make a difference that these objects are inside horizontal layout groups that have content size fitters?

swift crag
#

Do they have a parent that also has a layout group?

#

You will see a warning in the ContentSizeFitter if so

halcyon summit
#

Yeah they're in horizontal layout groups for the rows, and all rows are nested inside a vertical layout group

swift crag
#

Okay, that's not correct.

#

This is going to screw up the layout calculations, since each horizontal object is going to be trying to set its own size

#

You should have one content size fitter, and it should be on the "Content" object

#

The gist of auto layout is that each layout group asks its children for how much space it needs, then asks for enough space to contain them

#

If you don't have layout groups all the way down, an object will ask for zero width and zero height

#

ContentSizeFitter is used when you don't have a layout group in your parent

#

like on the Content object in a default scroll view

rich adder
swift crag
#

i'll need to see the hierarchy to say anything more concrete

swift crag
#

an example

halcyon summit
swift crag
#

ah yep, that's it

#

what is "Empty space" for on the "Classic Skin 1" object?

rich adder
halcyon summit
#

You can see it here. It's just a rectangle with the background colour. I just made it as an easy way to make the green border

swift crag
#

i thought that was what "BG" would be for

devout flume
#

Can we change splash screen images without a pro+ plan?

rich adder
halcyon summit
#

newColour being a hex

devout flume
rich adder
devout flume
#

Oh

#

Damn

rich adder
halcyon summit
#

No, changing the material itself so that every object with that material will update

swift crag
#

Anyway, you need to add a LayoutElement to "Classic Skin 1". Turn on Minimum Height to enforce the height. Turn on Flexible Width so that it'll grow to fill the horizontal space.

"Classic Skin 1" should not have a layout group on it. All of its children should also not have layout groups or layout elements on them.

Set all of those children to stretch in both axes, then adjust the left/right/top/bottom properties to create margins as needed (e.g. the "Swatch" should be pulled back on all four sides a little)

Next, make sure that "Row 1" has a HorizontalLayoutGroup. It should be set to control child size in both directions. Turn off "force expand" in both directions.

Next, make sure that "Content" has a VerticalLayoutGroup and a ContentSizeFitter. Configure the layout group as above, and then make sure the content size fitter uses the minium size vertically.

#

I believe that your current setup is causing the swatch image to shrink down to 0x0 in size

dire tartan
#

if i wanted to make a physcis lever would i use a configarble joint and lock the other axis?

rich adder
#

what kind of lever, hinge also works

swift crag
dire tartan
#

i want it to be able to go up and down

rich adder
dire tartan
#

and the character can move it by grabbing the end and pulling it up or down

rich adder
swift crag
dire tartan
#

okay i will try that

rich adder
#

configurable joint is prob one of the hardest ones to tinker with

swift crag
#

It swings around a single axis

rich adder
#

yeah def a hinge

halcyon summit
swift crag
#

you will want to do that on every layout group

halcyon summit
#

Ah yeah, missed that, thanks. Now Content is 0 altogether. Is that to do with the min height of my Elements, which are currently 0?

swift crag
#

Show me the inspector for Row 1

halcyon summit
swift crag
#

and now for Classic Skin 1

halcyon summit
swift crag
#

You need a non-zero Min Height

#

set that to whatever you want the element's vertical size to be

night sparrow
#

Can someone help with this code, It gives me error Not sure why as the thing i need IS assigned in the inspector script!

public class Health : MonoBehaviour
{
    public int health;
    public bool isLocalPlayer;

    public RectTransform healthBar;
    public TextMeshProUGUI healthText;
    private float originalHealhBarSize;

    private void Start()
    {
        originalHealhBarSize = healthBar.sizeDelta.x; // Error for the healthBar.
        healthText.text = health.ToString();
    }

    [PunRPC]
    public void TakeDamage(int _damage)
    {
        health -= _damage;

        healthBar.sizeDelta = new Vector2(originalHealhBarSize * health / 100f, healthBar.sizeDelta.y);
        healthText.text = health.ToString();

        if (health <= 0)
        {

            if (isLocalPlayer)
                Debug.Log("Respawn");

            Destroy(gameObject);
        }
    }
}```

```c#
UnassignedReferenceException: The variable healthBar of Health has not been assigned.
You probably need to assign the healthBar variable of the Health script in the inspector.
UnityEngine.RectTransform.get_sizeDelta () (at <f7237cf7abef49bfbb552d7eb076e422>:0)
Health.Start () (at Assets/Scripts/Health.cs:18)
swift crag
halcyon summit
#

Aha alright, thanks

rich adder
rich adder
rich adder
night sparrow
rich adder
polar acorn
# night sparrow

Run it after the game starts, when your error is in the console

dire tartan
rich adder
#

why did you not use hinge like suggested ?

#

what is even the point of asking others if you dont take their responses

dire tartan
#

i think i added the hinge whilst in game mode and it undid it my bad

night sparrow
#

Thanks though

full imp
#

Hey, I'm trying to implement an inventory system with PUN but I keep on getting this error when picking up an item.

#

This is the part of the script where it calls the add item method

IInventoryItem item = collision.collider.GetComponent<IInventoryItem>();
        if (item != null)
        {
            Debug.Log(item.Name);
            Debug.Log("collect item");
            inventory.AddItem(item);
        }```

and this is the inventory class

```c#
public class Inventory : MonoBehaviour
{
    private const int SLOTS = 10;

    private List<IInventoryItem> mItems = new List<IInventoryItem>();

    public event EventHandler<InventoryEventArgs> ItemAdded;

    public void AddItem(IInventoryItem item)
    {
        if (mItems.Count < SLOTS)
        {
            Debug.Log("Hit Item");
            Collider collider = (item as MonoBehaviour).GetComponent<Collider>();
            if (collider.enabled)
            {
                collider.enabled = false;
                mItems.Add(item);
                item.OnPickUp();

                if (ItemAdded != null)
                {
                    Debug.Log("Add item");
                    ItemAdded(this, new InventoryEventArgs(item));
                }
            }
        }
    }
}

If there's anything obvious I've done wrong please let me know, thanks 🙂

north kiln
#

Use TryGetComponent instead of GetComponent and checking for null

full imp
polar acorn
shell sorrel
#

casting to a MB to use GetComponent is really weird

full imp
shell sorrel
#

like would have methods on the interface to do the checks you need, or simple have GetComponent be part of the interface

shell sorrel
#

MonoBehaviour

full imp
#

ah

spiral narwhal
#
        protected bool isOnPointer;

        public void OnPointerEnter(PointerEventData eventData)
        {
            isOnPointer = true;
        }

        public void OnPointerExit(PointerEventData eventData)
        {
            isOnPointer = false;
        }

        private void Update()
        {
            HandleHighlight();
        }

        private void HandleHighlight()
        {
            if (isOnPointer) HighlightSelf();
            else UnhighlightSelf();
        }

Because of the way the objects are layered, when the mouse moves from left to right, OnPointerEnter is called before OnPointerExit, and when the mouse moves from the rightmost card to the leftmose, the other way around. However, I would need either to be called in both cases. Any idea how?

rare basin
#

You know that there are events for UI element being Selected or Deselected

#

You dont need to make this system from 0

spiral narwhal
#

What does "Selected" even mean in this context

rare basin
#

If it's a UI, of course

shell sorrel
#

the selected in this context is mostly for stuff like gamepad/keys navigation

rare basin
#

Also for mouse

#

When you hover over UI selectable like button

spiral narwhal
#

Ok ok but that does not answer my question

rare basin
#

It is also selected

polar acorn
# spiral narwhal ```csharp protected bool isOnPointer; public void OnPointerEnte...

Make a manager class that has a variable for the currently hovered card. Have that object use raycasts to detect which card is currently hovered. Whenever that value is different from what it used to be, send a message to the old card telling it to unhighlight itself, then change the selected card, then tell the new card to highlight itself

full imp
#
IInventoryItem item = collision.collider.GetComponent<IInventoryItem>();
        if (TryGetComponent<IInventoryItem>(out item))
        {
            Debug.Log(item.Name);
            Debug.Log("collect item");
            inventory.AddItem(item);
        }```
So I managed to turn it into this using the TryGetComponent but nothing's happened - that means that item is null?
full imp
#

oh right

shell sorrel
#

nuke the first line of it and make it
if (collision.collider.TryGetComponent<IInventoryItem>(out var item))

full imp
#

Oh thanks that's made it better

#

I'll have to look for a way to make inventory not null as that seems to be the main problem

thorn kiln
#

So I got kind of an esoteric question. I play a lot of games where, if they're not in fullscreen, they have the maximize button greyed out. This irks me to no end. Is it super hard to impliment or something?

shell sorrel
#

heavily depends on the game engine and how UI works

#

often its done that way so the aspect ratio can be enforced

thorn kiln
#

Well the one Im looking at right now is unity

shell sorrel
#

its prolly so they can enforce the window be like 16:9 or something

#

that way you can like maximize it on a ultra wide

#

or because they want to use very exact resoultions

open apex
#

So I have a quick question for the pros, I am trying to code player movement. I 1st learn to make a player move by adding force to it and now I have discovered "CharacterController". Does it really matter or is it really important how you code the player movement? I feel like a b**ch for using something like this instead of hard coding the movement by myself.

rocky canyon
#

u still code the movement.. the character controller is just the component u tell to move. the only thing it does is has built in ground checks and the ability to collide and traverse stairs

frosty hound
#

If it turns out how you want it, it doesn't matter how you made it.

gritty notch
vast vessel
#

hey guys.
im getting an error saying i haven't given the match argument even though i have. what's the issue?

List<Assault_RallyPoint> validRallyPoints = rallyPoints.FindAll(CanUseRallyPoint);
public static bool CanUseRallyPoint(Assault_RallyPoint rallyPoint) => rallyPoint.shouldLockRallyPoint ? !rallyPoint.occupied : true;
wintry quarry
vast vessel
# polar acorn What is the actual error

Error CS7036 There is no argument given that corresponds to the required parameter 'match' of 'Array.FindAll<T>(T[], Predicate<T>)' DELTAV D:\Aperture-Delta-V\DELTA-V_HDRP\Assets\Scripts\DeltaVBase\AI_AgentSys\Sequences\Sequence_Assault.cs 55 Active

wintry quarry
#

or rather

#

it needs a first one

#

Should be Array.FindAll(rallyPoints, CanUseRallyPoint);

gritty notch
polar acorn
wintry quarry
vast vessel
wintry quarry
gritty notch
wintry quarry
vast vessel
#

public List<Assault_RallyPoint> rallyPoints = new List<Assault_RallyPoint>();

wintry quarry
#

something isn't adding up

#

the error clearly thinks it's an array

open apex
willow nexus
#

when i use Destroy(gameObject) on an object, the particles it has already emitted also get destroyed
is there another way to do this?

I'm instanciating a little light glow effect that shoots out some particles, but i want to remove it without destroying the particles its already made

wintry quarry
river pecan
#

Or don't destory it yeah

wintry quarry
#

you can't destroy the particle system and expect it to keep rendering particles

gritty notch
wintry quarry
#

it's a lot more than that
for example where is this line?

willow nexus
#

so i should separate the particle system onto a parent object
destroy the light child component
and stop producing particles then destroy the main one like 10 seconds later?

gritty notch
wintry quarry
#

you should be using a trigger

river pecan
willow nexus
#

its being instanciated every time the player picks up an item so i have to destroy it
ill do this

river pecan
#

Destroy(gameObject, delay)

hazy crypt
#

guys I swear im losing my mind, my charater is flying off into the distance and I dont know why

open apex
#
{ 
private CharacterController _controller;

void Start()
    {
        _controller = GetComponent<CharacterController>();
    }
    
void Update()
    {
    Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    _controller.Move(move * Time.deltaTime * Speed);
    }
    
}```

This is one example where CharacterController is used,
 And this is another, why would they use "GetComponent" if the game is solo and not multiplayer?
river pecan
hazy crypt
#
void Update()
    {
        transform.position = rb.transform.position;
    }

    private void FixedUpdate()
    {
        rb.AddForce(transform.forward * forwardAccel);
    }
#

why does this make my object fly

#

is it olliding with itself?

river pecan
#

You're moving twice

#

AND

#

Adding a lot of force

hazy crypt
#

it should be gently rolling forward, but its flying off into the sky

river pecan
#

Set the velocity

#

Not add

wintry quarry
wintry quarry
#

which may be up

#

or down

river pecan
#

Actually

hazy crypt
wintry quarry
#

it will change as it rolls

river pecan
#

You're not doing anything

#

with the update

wintry quarry
river pecan
#

I read the code wrong

#

depends on the rigidbody

wintry quarry
hazy crypt
#

Im attempting to ollow this tutorial

wintry quarry
#

why are you doing this

hazy crypt
#

terrible screenshot

#

my bad

wintry quarry
# hazy crypt

I would guess you set up the scene incorrectly compared with whatever the tutorial is doing

hazy crypt
#

I thought the same but I cant see how

#

He has an empty game object with some visuals attached

#

then adds a sphere to add rb forces

#

If you have the patience

#

its 5 mins in

#

the objet setup is 2 mins in

wintry quarry
#

This is a weird setup

polar acorn
river pecan
#

Yeah

wintry quarry
#

a child Rigidbody with a parent object that follows it?

#

😬

river pecan
#

Why not just add the rigidbody to the model?

wintry quarry
river pecan
#

Or have the model be the child

wintry quarry
#

maybe your parent object is rotated incorrectly for example

hazy crypt
#

I would love to find another solution to my goal but Im still a real beginner and this tutorial basically achieves it

wintry quarry
# hazy crypt

make sure this is on local so you can see which wat it's really facing

hazy crypt
#

I dont know enough to find a better solution

rocky canyon
#

u probably should have the rigidbody on the Player

open apex
rocky canyon
#

and the collider.. the sphere should jsut be graphics