#💻┃code-beginner

1 messages · Page 258 of 1

native seal
#

and the "lowest" tier is chosen as the best

#

yea, kinda confusing but based on other similar games

radiant frigate
#

wait i´ve just went thru the first line xD

#

can i see a bit of your game?

#

your code looks clean (atleast compared to mine)

native seal
#

its very work in progress rn lol

#

it looks very bad but im just focusing on systems right now

radiant frigate
#

i like to look at basic plane cubes move

radiant frigate
native seal
#

heres a picture of some gameplay lol

radiant frigate
#

is it a vampire survivor type game ?

native seal
#

kind of

#

more similar to diablo 3 or path of exile

radiant frigate
#

ohhhh

#

i played diablo 4

#

idk if that is any close

native seal
#

yea like that

#

all diablos are basically the same

radiant frigate
#

so an rpg it is?

native seal
radiant frigate
#

looks cool asf

native seal
#

thanks

#

its my first game so probably pretty bad overall

radiant frigate
#

it depends

#

compared with a AAA game of course

#

but compared to others guys first game

native seal
#

yeah maybe lol

#

we'll see how it turns out

#

only been working on it for the past 2 months

#

got a long way to go

radiant frigate
#

yeah

#

keep up the grind

#

it will eventually pay off

native seal
#

you too

radiant frigate
#

i will!

#

have you seen my game?

#

its pretty basic

native seal
#

send some screenshots

radiant frigate
#

alright

#

i want to show you the variety of how my system works

#

if i give the system 17 coins

#

those are the enemies

#

and if i give it 57 coins

#

67*

#

but it looks better in a video since it is visible how they start stacking

queen adder
#

first 2d game do i make project with 2D or 2D SRP?

native seal
#

so is it not working how you want right now?

radiant frigate
#

yes it is

#

im pretty happy with the results

#

and if i dont like something i can change it with the variables

native seal
#

nice

radiant frigate
#

imma try to record how it looks

#

the game is not supposed to have that much enemies thats why the lack of variety

#

(im working on 2 more )

#

wait wrong video

#

this is the one

radiant frigate
native seal
#

nice looks cool, like a bullet hell

native seal
vale cradle
#

I don't understand this error can someone please help me

#

my enemy is moving but it's not shooting fire ball when the player is in range

#

i get the thing saying paremeter is not set

timber tide
#

stack trace is nice, but code would help

vale cradle
#

okay

timber tide
#

oh it's the animator

vale cradle
#

sorry?

timber tide
#

animator does a string lookup and you're giving a value that does not exist in the animator

vale cradle
#

i'll share the ss just a min

timber tide
#

it's less of a code issue and more of you not setting your animation tree up correctly

#

or perhaps feeding it the wrong string value

vale cradle
#

in this?

timber tide
#

right

vale cradle
#

what should i do here?

timber tide
#

w/e range attack trigger should correlate to

vale cradle
#

just a min

#

what is w/e?

#

sorry

#

@timber tide

timber tide
#

whatever

vale cradle
#

oh

#

okay

#

I am still stuck i don't understand what's wrong

timber tide
vale cradle
timber tide
#

You have a variable inside of your animator called explode which is the problem, so go back to the part where you set that and follow it through.

vale cradle
#

i even checked comments and it's not helping i rechecked the whole clip too

minor patio
#

I'm stumped: I've got a method on a button object that is being executed twice

#

I've tried using the debuggerer, but it just confirms that the method is finding an object twice on me

#

anyone like to look at spaghetti?

#

I'll take that as an "I'm full, thanks" XD

ivory bobcat
#

Don't ask if someone's available to look at the code. Just provide the code, hierarchy, inspector data and console logs.

#

https://dontasktoask.com/

Someone who is idling on the channel and only every now and then glances what's going on is unlikely to answer your "asking to ask" question, but your actual problem description may pique their interest and get them to answer.

queen adder
#

watching a tutorial and in his vscode some words autocomplete and are highlighted while in mine they arent how do i set this up

ivory bobcat
eternal falconBOT
minor patio
#

#metoo

#

so I figured out from the debugger that for some reason after applying all my code the object returns to a null state

#

it's a proper quandry...

#

..but I think I've had enough for tonight...

queen adder
#

isnt it meant to say samples in that blank box next to walk left

scarlet skiff
#

WHy wont this get detected in this script

The object with the script has trigger collider, no rb
the object that wont get collided with currently doesnt have trigger collider, but i tried that and nothing happened.

Full script: https://gdl.space/nexasuquqa.cs

lost anvil
#

the los script sets the patrol and chase functions

sour cave
vale cradle
#

@timber tide I fixed the error for fireball but now i am getting that the explode parameter does not exist ( for explode the fireball explodes when it touches any surface)

scarlet skiff
sour cave
timber tide
scarlet skiff
sour cave
scarlet skiff
#

well, here is how its set up:

I have a parry hitbox, trigger hitbox, that has that script.
It is supposed to detect parryable objects and put them in a list.
Thats what the script does

sour cave
scarlet skiff
sour cave
ivory bobcat
scarlet skiff
hexed fractal
scarlet skiff
#

the parry hitbox

hexed fractal
ivory bobcat
scarlet skiff
#

the parried (but wont get parried which is the problem)

hexed fractal
#

i keep getting errors that go against one another ffs

scarlet skiff
vale cradle
scarlet skiff
hexed fractal
#

Bro what the hell

ivory bobcat
hexed fractal
#

how is this possible guys

#

If i do one thing i get the error

#

and if i fix the error i get the other

ivory bobcat
# hexed fractal

You cannot assign the quaternion rotation a vector 3. It's expecting a quaternion.

hexed fractal
#

i know

#

eulerAngles

#

are Vector3 angles

#

degrees

#

rotation is a Quaternion

#

i DID that

scarlet skiff
ivory bobcat
#
rotation = Quaternion.Euler(...);```
scarlet skiff
#

based on players position (a 3rd object unrelated to this)

hexed fractal
#

Vector3 dir = transform.eulerAngles;
Quaternion dir = transform.rotation;

#

i do this

#

wait no

#

im confusing myself nor r u helping rn lmao

ivory bobcat
hexed fractal
#

since its a vector 3

#

then it told me about converting it to quaternion

#

which isnt correct since it takes vector3s

sour cave
#

Then convert from one to another.

hexed fractal
hexed fractal
ivory bobcat
ivory bobcat
#

You cannot assign a quaternion the value of a vector 3

hexed fractal
#

eulerAngles

#

is a

#

vector3

#

what are you ON ABOUT

ivory bobcat
hexed fractal
#

huhhh?

hexed fractal
#

CAN YOU SEE THAT

scarlet skiff
ivory bobcat
scarlet skiff
#

with the current set up i cant move it with physics its just not effecient in my situation i dont think

hexed fractal
#

bro im just tryna make my player

#

turn to the direction

#

that its moving

ivory bobcat
#

You cannot assign a quaternion the value of a vector 3cs transform.rotation = Vector...//illegal

hexed fractal
#

that isnt correct

hexed fractal
#

i know

teal chasm
#

Im trying to relearn c# currently, is there a vid someone can send me on animation thru unity

eternal falconBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

hexed fractal
#

I dont know how im supposed to smoothly turn my player to the direction it walks now because this clearly isnt working

teal chasm
#

!learn

eternal falconBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

teal chasm
#

How do i use it?

#

Nvm

ivory bobcat
#

Consider using rb move position if you aren't necessarily wanting to teleport

scarlet skiff
ivory bobcat
scarlet skiff
magic pagoda
#

heyy chat!

so, I have this script here that draws a circle and spawns some things in it.

however, the circle is drawn in the middle of the screen and I want it to be drawn around the object the script is attached to.

how can I pull this off?

short hazel
magic pagoda
#

oo I was thinking it could be that but I wasnt sure.. thank you! ^^

ivory bobcat
#

target.position + offset would be what you'd want to pass as an argument for the position of Instantiate.

scarlet skiff
magic pagoda
#

one small issue--

ivory bobcat
#

Probably cast the result from the stuff on the right side of the addition operator to vector 3

#

Or vice versa

magic pagoda
#

fixed iiit

hexed fractal
#

I love you guys

scarlet skiff
queen adder
#

guys my raycast gets a object only once and proceeds to get the boject behind it also jsut once

ivory bobcat
#

You'd probably want to show the !code that's got conflicts

eternal falconBOT
ivory bobcat
#

Your options are either inline for small snippets or the free services linked for large code blocks.

queen adder
#

so should i sedn the script now

silent venture
#

Hi guys, I'm new to Unity Coding, coming from Game Design background. I know I want to create ambitious things which I can design quickly on paper, but I have no idea about the complexity of the coding part.

I would like recommendations for learning approach and resource links to get myself started.

Thank you.

I have completed the Roll-A-Ball tutorial btw, that has been a good start for me until now

ivory bobcat
#

For the links: you'd paste your code there, save using the button somewhere on the service site and post the updated link here.

queen adder
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Dooropening : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if(Physics.Raycast(transform.position, transform.forward, out hit))
        {
            Debug.Log(hit.transform.name);
            OpenDoor Script = hit.transform.GetComponent<OpenDoor>();
            if (Script != null)
            {
                if (Input.GetKeyUp("e"))
                {
                    Script.Interact();
                }
            }
        }

        
       
    }
}

#

bum

eternal falconBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

hexed fractal
#

Is there a SmoothDamp that works for rotation

#

or is similar to how smoothdamp works

magic pagoda
#

heyy Im back again! ^^;

same script, this time I wanna destroy the object after spawning a certain amount of rubies but... the object doesnt get destroyed and just keeps spawning them!,

hexed fractal
#

because i really wanna make my player rotate just like it

silent venture
#

@ivory bobcat thanks a lot. Which pathway would be best? Junior Programmer?

#

I am focusing on building basic games, mechanics based and prototypes at best, nothing too complex for now

rare basin
#

your loop runs untill i <= rubyDropCount

#

so i > rubyDropCount will never be true

short hazel
#

Without the if statement

magic pagoda
#

although... brb

short hazel
#

It won't, it's just that all of them are spawned at the same position (because you compute the random once)

queen adder
#

guys wth is wrong with my code the raycast gets the object behind other object and it gets everything just once and never again

#

this is happening to me for the first time

queen adder
#

huh

#

idk man it doesent make any sense

ivory bobcat
hexed fractal
#

i dont understand what u are tryna say rt at all

magic pagoda
queen adder
#

my brain it burning

#

i wouldnt understand it either

hexed fractal
#

your sentence was just

queen adder
#

ist complicated

hexed fractal
#

useless to me

queen adder
#

damn

hexed fractal
#

i dont understand what ur askingg

#

gets the object being the other object so ur blacklisting a layer?

short hazel
queen adder
#

the variable hit only gets the object once and when i look at it again it just doesent

#

get it again

#

only once

ivory bobcat
queen adder
#

omfg

#

no way

#

i forgot

hexed fractal
#

lmao

silent venture
queen adder
#

so sorry

#

lmfao

queen adder
silent venture
#

Nah, I wanna type things, love the sound of mechanical keys

#

Thanks, I'll walk the pathway of Junior Programmer then.

cobalt creek
#

yea I think it good if you transitioned from ue, though it takes so long to build with visual enabled/installed

sterile loom
silent venture
#

I use UE for mostly Level Design and stuff

queen adder
#

man i jsut read all the messages i jsut sent and oh god the misspleiing in those

short hazel
scarlet skiff
desert flume
#

Any idea on how to recreate something like this?

desert flume
#

Looks easy enough but I dont see how I can make the side walls move up infinitely

hexed fractal
#

i got entirely ignored lol

desert flume
#

never done animations before

hexed fractal
#

Is there a SmoothDamp that works for rotation or similar to how SmoothDamp works because i really wanna make my player rotate just like it

short hazel
desert flume
#

you are smart

#

those problem solving skills are crazy

hexed fractal
#

anyoneee?

ivory bobcat
cosmic dagger
cobalt creek
#

it also look like camera movement and just outside camera view new obstacle being created and destroyed

hexed fractal
#

so i cant

cosmic dagger
hexed fractal
#

i couldnt

#

i have errors with it alreadyy

#

so i used some Quaternion thing

#

and it doesnt work like SmoothDamp

short hazel
# desert flume those problem solving skills are crazy

It's a bit more complicated to make though, you need to make a material and put your texture on it, then access that via script. Or go full custom and make a shader that does this out of the box.
The "easiest" solution would be to have two walls on top of each other, and when one goes off screen you teleport it down below the one still on screen.

cosmic dagger
# hexed fractal i have errors with it alreadyy

well, i'd start by fixing the error. at least post and show what you have. you can simulate a smooth damp using slerp/lerp as well. there are many options, but it depends how you move/rotate your object . . .

hexed fractal
#

bro i told my error before

#

i dont think theres a way to get around it

#

im using RotateTowards rn


float horizontalInput = Input.GetAxisRaw("Horizontal");
float verticalInput = Input.GetAxisRaw("Vertical");

Vector3 movementForce = ((verticalInput * Vector3.forward) + (horizontalInput * Vector3.right)).normalized * movementSpeed;
movementForce = cameraTransform.TransformDirection(movementForce);

if (movementForce != Vector3.zero)
{
    Quaternion toDirection = Quaternion.LookRotation(movementForce, Vector3.up);

    transform.rotation = Quaternion.RotateTowards(transform.rotation, toDirection, rotationSpeed * Time.deltaTime);
}

desert flume
short hazel
#

That's what my last solution does, with 2 per side you scroll up continuously and warp them when they go off screen

desert flume
#

is 2 enough

#

might look laggy

short hazel
#

As long as each one is bigger than the height of your screen there won't be any issues

sterile loom
short hazel
#

Scrap that off and use an animator Blend Tree! They're made for this kind of stuff

#

You pass the input X/Y to the Animator and it decides which animation to play by itself, look it up

buoyant knot
#

Also I would avoid hard coded strings like that. It will make you go crazy.

sterile loom
#

my concern is that when I add too many animation i'd end up with an animator that looks like this

buoyant knot
#

one thing you can do that might help (since unity will force you into strings) is to define:
private const string IDLE_1 = “Idle1”;

#

that is spaghetti

short hazel
polar acorn
#

You have Any State and the ability to make sub-graphs and groupings to keep an animator clean

buoyant knot
sterile loom
#

lemme look up how to use the blend tree thanks guys

polar acorn
#

With blend trees you can easily achieve a hierarchy like this

buoyant knot
#

imagine a game making program where everything is just a big graph of nodes (like shader graph) for visual scripting.

#

this is actual code. not mine. but it is a thing

shy ruin
polar acorn
buoyant knot
#

i do not know how people get this far, but life finds a way

#

and it doesn’t have to look like that. people just do

#

my code for reference

#

(not trying to flex, just to show the difference for people without context)

sterile loom
#

sorry one more thing, is there a way to use different blend trees? by that I mean for example you're using a sword, obviously you'd have different animations than with a bow

buoyant knot
#

point being, when you make any sort of graph-based code, you need to be on top of it to keep it organized

#

because it can easily turn to spaghetti

timber tide
#

my blend tree is usually entry -> node -> entry

#

but ive not really made anything intensive that dark souls

buoyant knot
#

my advice is to use space to keep “blocks of code” together. And try to make it read roughly left-to-right, top-to-bottom

#

just manipulating the effective “whitespace” and relative placement in 2D will do wonders

buoyant knot
quartz mural
#

@polar acorn

#

sorry?

#

i did what u asked no 😭

queen adder
#

unity is messing up the colours on my pixel art sprite and i dont know why? what i did was press import asset, pick the png i just made, change pixels per unit to 16 and change filter mode to point no filter

queen adder
desert flume
#

how do i make

#

a rigidbody stop moving when it hits another rigidbody

#

due to gravity

#

like, if we jump, we stop going down once we hit the ground

#

thats what i wanna achieve

slender nymph
#

make sure the rigidbody is not kinematic so it reacts to outside forces like collisions and make sure it has a non-trigger collider

#

otherwise you'll need to control its velocity manually for collisions

ruby python
#

!code

eternal falconBOT
ruby python
#

Okay, revisiting this one cause the maths is driving me nuts.

This is a small chunk of code to work out Long/Lat values based on my ships position.

The Longitude seems to be working perfectly, but the Latitude calculation is very very wrong (it hits a latitude of 90 almost immediately when moving north/south.

void Update()
{
    RaycastHit hit;
    // Does the ray intersect any objects excluding the player layer
    if (Physics.Raycast(eagleGPSRayEmitter.position, eagleGPSRayEmitter.TransformDirection(-Vector3.up), out hit, Mathf.Infinity, layerMask))
    {
        eaglePosX = hit.point.x;
        eaglePosY = hit.point.y;
        eaglePosZ = hit.point.z;
        //Debug.Log(hit.point);
    }

    longitude = (Mathf.Atan2(eaglePosZ, eaglePosX) * Mathf.Rad2Deg) - 90f;
    latitude = (float)Mathf.Acos(eaglePosY) * Mathf.Rad2Deg;

    // this bit is to flip and quarter rotate the latitude number to put it where you would expect
    // (assuming you are an earthling)
    // with 0 at the equator, 90 at the north pole and -90 at the south pole
    latitude = (latitude - 90f) * -1f;

    Debug.Log("current long = " + longitude);
    Debug.Log("Current Lat = " + latitude);
}

I'm 99.9% certain it's an issue with using Mathf.Acos but I don't know what else to use to be perfectly honest. Could anyone help please? 😕

hexed fractal
#

Is there a SmoothDamp that works for rotation or similar to how SmoothDamp works because i really wanna make my player rotate just like it

magic pagoda
#

hi chat! ^ -^

so, I have this script here that is supposed to destroy a certain type of object when the player touches it.

however, the object has two trigger colliders. a box collider 2D and a circle collider 2D.

how can I make the object get destroyed only when player touches the box trigger and not the circle trigger?

hexed fractal
#

single issue

#

you have

#

you are here

#

chatgpt or online

magic pagoda
#

bro wth

hexed fractal
#

are very normal alternatives

ruby python
hexed fractal
#

or uses it

magic pagoda
#
  1. chat gpt isnt accurate at all

  2. this is the CODING HELP chat

  3. this is my SECOND time coming here today, and before today was SEVERAL WEEKS ago

slender nymph
hexed fractal
magic pagoda
#

bro's mad I come to the code help chat to ask for code help

hexed fractal
#

for a 2nd time

#

lol

magic pagoda
hexed fractal
ruby python
#

I always get them mixed up if honest. But yeah I think so.

magic pagoda
hexed fractal
magic pagoda
#

wth is wrong with you anyway

hexed fractal
#

my native language is Welsh

#

lol

short hazel
magic pagoda
#

f me I guess for asking for help in an ASKING FOR HELP chat

short hazel
#

Go troll somewhere else

hexed fractal
timber tide
#

just ignore the troll

magic pagoda
#

what kind of toxic troll do you have to be

hexed fractal
#

ur so angry

slender nymph
ruby python
#

Not the place dude. And tbh, I've asked more questions than him today.

magic pagoda
#

smfh... 4 chan twitter ass troll.

hexed fractal
radiant frigate
#

xD

ruby python
#

lol

hexed fractal
#

i told you you can use chatgpt or just google

magic pagoda
#

aight, blocked, anyhow

hexed fractal
#

THEN ask

radiant frigate
#

kewk

hexed fractal
#

its not hard to fucking get that in ur head is it

hexed fractal
#

¯_(ツ)_/¯

hexed fractal
ruby python
hexed fractal
#

talking like u got above average testosterone levels

slender nymph
hexed fractal
#

it doesnt matter

short hazel
# magic pagoda aight, blocked, anyhow

Do you have multiple triggers on the same object? If you want to detect which one has been hit, then you can't! You should put them on two different objects

hexed fractal
#

🤓

ruby python
hexed fractal
#

most people fake block

short hazel
magic pagoda
hexed fractal
radiant frigate
#

bro straight up must have had a flabbergasting notice from somewhere for acting like this

short hazel
#

Pushing questions up

radiant frigate
#

nathan just a question but do you really get something out of this?

magic pagoda
hexed fractal
slender nymph
hexed fractal
#

nope. only entertainment which wastes your time of doing something productive

magic pagoda
hexed fractal
#

so i dont understand ur question

radiant frigate
magic pagoda
#

would there be any benefit in using == for checking tags in any scenario btw?

slender nymph
#

no

magic pagoda
#

thank you!! ^ .^

hexed fractal
ruby python
radiant frigate
slender nymph
hexed fractal
modest dust
hexed fractal
#

while a kid gets angry over me telling them some shit

magic pagoda
#

oof, still here hm?

hexed fractal
#

they assume its an argument instantly

#

💀

magic pagoda
#

at this point I think that they get off to it lmao.

radiant frigate
#

i just want to know why would he do that, just genuine concern for him, maybe he is going thru shit idk

hexed fractal
fickle plume
#

Enough with the off-topic

timber tide
#

just ban em honestly

hexed fractal
slender nymph
#

fr, the blatant transphobia should be enough for a ban

radiant frigate
hexed fractal
fickle plume
#

Still catching up

radiant frigate
#

wanna see how my game is going?

#

(if you can call it a game)

modest dust
dawn kestrel
#

I don't understand how default positions are assigned in Unity. The white gizmo is the BoxRegion script I made, and I don't understand what caused it to be so far out.

timber tide
#

for one you got handles* assigned to center instead of by pivot, so that may cause some confusion for where you may think it should spawn

radiant frigate
hexed fractal
#

i love how this started over a missunderstanding 💀

modest dust
hexed fractal
#

I thought they were here throughout the day asking

#

but its just the fact they spawned in at the exact same time as me

fickle plume
#

!ban save 680496323882909706 Off-topic spam, transphobic comments.

eternal falconBOT
radiant frigate
#

the timing on that xD

ruby python
#

🤣

magic pagoda
radiant frigate
#

what is ywnbaw?

magic pagoda
#

"you will never be a woman", something transphobes tell trans people.

#

anyhow, to get back on topic...

radiant frigate
#

ohhhh

magic pagoda
#

so, CompareTag is better than .tag ==, right?

ruby python
slender nymph
kindred stratus
#

Does anyone have a 4 way movement script for a 2d game I have been trying to make one for like a week with my horrible coding skills and nothing has worked

slender nymph
#

there are plenty of tutorials for that

magic pagoda
ruby python
kindred stratus
#

K thank you!

ruby python
#

A lot of tutorials just go through and tell you what to type without explaining why and what each line of code is actually doing.

magic pagoda
#

a 4 way movement system would be a great thing to start learning unity tbh. you learn

  • components, as well as a very essential component (rigidbody)

  • physics

  • inputs

#

aanyhow... I should have dinner now. byee chat!! uwu

dawn kestrel
slender nymph
#

set the tool handle in the upper left of the scene view to Pivot instead of Center so you can see where the object you have selected is actually at. right now you are seeing the approximate center of the object and all of its children

dawn kestrel
#

ah

swift crag
#

(the shortcut is X)

#

er, Z

#

X is local/world

slender nymph
#

ooh i had no idea there was a shortcut for that

timber tide
#

also from the screenshot the object selected is a child to another object, so positioning you are doing will be relative to the parent

swift crag
#

i randomly push it by accident and thus wind up in Awful Center Mode

dawn kestrel
#

though, I'm still confused as to how the gizmo ended up out so far.

covert sinew
#

When I invoke an event, can I pass a variable from it to any listeners somehow?

slender nymph
slender nymph
swift crag
#

you'll need to change the type of the event, of course

#

System.Action<int> to pass an integer

slender nymph
#

or UnityEvent<int> if using unity events

dawn kestrel
swift crag
#

The capsule collider is offset by a large distance on the Z axis and the box is offset by a small amount on the Y axis

dawn kestrel
#

somehow it managed to perfectly center itself on an unrelated object

swift crag
#

so it's probably going to be "centered" on something else

#

notably, on its parent, Catapults

dawn kestrel
#

oddly, it's neither on the pivot or center of Catapults

#

(or TeleportSystem)

slender nymph
#

that's literally the same position as the object you showed before so it is on the pivot of catapults

swift crag
desert flume
#

im currently randomly generating those platforms

#

but how can I make them not generate on top of each other

dawn kestrel
#

I mean the small white box

swift crag
#

Catapults' position isn't [0, 0, 0], sure -- that just means that it has been repositioned relative to its own parent

desert flume
#

like, a new platform will never be above the currently highest platform

swift crag
#

This thing?

dawn kestrel
#

yes

desert flume
#

nvm its easy

swift crag
#

I don't know what that is.

desert flume
#

ignore my question

dawn kestrel
#

that's the gizmo being drawn by the Box Region script on Catapult (0)

ruby python
swift crag
#

well, that's your own code. it can draw whatever it wants

#

you should show us the code for this component

slender nymph
#

are you certain the gizmo is being drawn correctly

swift crag
#

notably, you may be drawing it in the wrong space (world space vs. a specific transform's local space)

#

or you could be calculating it wrongly, or many other things

dawn kestrel
swift crag
#

This is working in world space

#

If every BoxRegion component has the same size and center values, every component is going to draw the gizmo in the s ame spot

#

they're also all going to be doing the physics queries at the same spot

#

The position of the game object that BoxRegion is on will not matter at all.

ruby python
#

Okay I think I know what's happening with that, you're drawing it in world space (with your public Vector3s), so it's not referencing the parent object.

I think you should be grabbing the position of the object you want the gizmo to be attached to and use that objects position with an offset on the Z axis so that it 'moves' the box to the center of its parent object.

swift crag
#

The correct approach is to transform both center and size from local space to world space, and then use those transformed values. You'd also need to combine your own transform.rotation with direction to correct apply your rotation.

#

That way, center will mean "the position in my own local space" -- so as the object moves, the resulting world-space position also moves

slender nymph
#

transform.TransformPoint and TransformDirection are going to be useful here (for the physics queries)

swift crag
#

TransformVector for size if you want your scale to matter

#

although...i'm not sure how that'll play with rotation

#

as long as there is no non-uniformly scaled parent, it ought to behave well

#
Vector3 WorldCenter => transform.TransformPoint(center);
Vector3 WorldSize => transform.TransformVector(size);
Quaternion WorldRotation => transform.rotation * direction;
#

Those should do the trick.

slender nymph
#

can probably set the Gizmos.matrix to the transform's localToWorldMatrix for the gizmo to draw correctly

swift crag
#

yeah, although that doesn't help you do the physics queries properly

#

i'd want the gizmos to exactly match what i'm actually using

#

oh, right -- you need to modify the matrix to rotate the gizmo, don't you

slender nymph
#

yep

swift crag
#

that's an annoying x-factor

slender nymph
#

unless you draw it manually which is a whole other beast

ruby python
#

This might be a stupid question, but what are the gizmos being used for?

#

As far as I was aware gizmos are an editor only thing or am I being an idiot? lol.

slender nymph
#

they are, but this code is performing physics queries and the gizmos are likely to show where that is happening

swift crag
#

They're used for visualization

ruby python
#

Okay gotcha.

swift crag
#

making gizmos can make your life a lot easier

ruby python
#

Yeah, it was all the physics comments that threw me. lol.

timber tide
#

I toss them on anything rotation related

swift crag
#

to elaborate on the matrix thing a bit

#

Gizmos.DrawCube doesn't let you specify a rotation. It only takes a center and a size.

#

Instead, you have to change the space you're drawing the gizmo in.

#

The default value of Gizmos.matrix is the default Matrix4x4. It's the transform matrix for something that is:

  • at the origin
  • not rotated
  • at the default scale
#
Gizmos.DrawBox(Vector3.zero, Vector3.one); // draws a cube at the world origin
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.DrawBox(Vector3.zero, Vector3.one); // draws a cube at your position, with your rotation and scale taken into account
#

By assigning a different matrix, you change the "point of view" that you draw the gizmo from

rich egret
#

!code

eternal falconBOT
swift crag
#

The idea I was thinking of would only account for your position and scale. It wouldn't let you draw a rotated cube.

Vector3 worldCenter = transform.TransformPoint(Vector3.zero);
Vector3 worldSize = transform.TransformVector(Vector3.one);
Gizmos.DrawBox(worldCenter, worldSize);
#

It's doing roughly the same thing as changing the matrix, except we can't account for our rotation.

swift crag
rich egret
#

Hi, when I put 2 weapon-type items in the equip system, it doesn't let me put a legend-type item, does anyone know why?
👇 👇 👇 👇 👇 👇 👇 👇 👇
https://gdl.space/onekifopom.cpp

swift crag
#

perhaps both WeaponList and LegendList are actually referring to the same list

#

we would need to see the entire script to say

short hazel
#

Yep that's the only option I see here

rich egret
swift crag
#

share the entire script please

short hazel
#

Also you don't need to check if the elements are there before removing them (lines 39, 43), Remove doesn't do anything if the item wasn't there
Well it returns false, but it won't throw an exception

violet nexus
#

if anyone here is using gorilla locomotion for their game, when i load in after a few seconds, it just sends me out the map.

rich egret
rich egret
swift crag
#

that means that your item's category equals "Weapon"

#

don't make it equal "Weapon"

#

you appear to be getting the category from a TextMeshProUGUI, which is...a bit odd

rancid tinsel
#

is there a collider function that checks continuous collision?

swift crag
rancid tinsel
#

specifically for trigger2D

ruby python
#

OnCollisionStay() I think.

swift crag
#

ah, I see

#

OnTriggerStay2D would be the one you want.

rancid tinsel
rich egret
short hazel
# rich egret ok just a minute

Just for good measure, even if you confirmed it, can you tell us the result of Debug.Log(object.ReferenceEquals(LegendList, WeaponsList));

rancid tinsel
#

and that would work without OnTriggerEnter?

ruby python
#

Yes.

swift crag
#

you can't really get around that

rancid tinsel
#

ok good, the IPointerDown/Up traumatised me last night lol

swift crag
rich egret
rich egret
swift crag
#

well, make sure that category is not "Weapon", then

#

look at your console

#

there is a button labeled "Collapse" in the top left

#

it merges identical log messages

covert sinew
#

What does this error mean? I'm trying to use a public enum in another class as a case for a switch statement. do I need to make another enum in the class I'm using it from?

rich egret
swift crag
#

I suspect it's hiding the fact that

 Debug.Log("EquipItem function called with item category: " + category);

is logging "weapon" three times

swift crag
# rich egret I checked it, that's not the problem

There is no way for your code to reach this line:

Debug.LogWarning("Cannot equip more than two weapons at a time. WeaponsList count: " + WeaponsList.Count);

without category.Equals("Weapon") returning true

rich egret
dawn kestrel
#

hmm, I thought gameObject.transform.position would reference the world position of the object the script is on, but it doesn't seem to be the case.

swift crag
#

that's what actually matters

#

it doesn't matter if your code works when you do things in a different order

#

the problem is that it doesn't work when you do things in this order.

rich egret
#

Just put the 2 weapons in front of the legend, that's all I do.
You want to see a video, maybe that will help?

swift crag
#

Look at the console after trying to equip the items in that order.

rancid tinsel
#

is there a way of doing this like I have here?

swift crag
#

Screenshot all of the log entries in the console after doing that.

rich egret
slender nymph
short hazel
rancid tinsel
slender nymph
#

right because you are trying to yield return in a method that returns void

short hazel
#

Perhaps you meant to make a coroutine

rancid tinsel
#

im wondering if there is a way to achieve the effect id like

short hazel
#

IEnumerator?

swift crag
#

yes, make it return IEnumerator and start a coroutine with the method.

#

just like you do with Slow

rich egret
rancid tinsel
#

not a coroutine because i dont want to slow for seconds, i didnt change the code in it yet thats my bad

slender nymph
#

then remove the yield return

rancid tinsel
#

oh yeah that works

#

😭

#

i didnt even notice

rich egret
#

@swift crag

rancid tinsel
#

is there a way to pass the enemyMovementInstance to it?

swift crag
#

You have collapse enabled.

swift crag
#

Then do it again.

queen adder
#

Hi

swift crag
queen adder
#

Anyone that would be willing to help me?

swift crag
#

Ask your question.

queen adder
#

Ok

short hazel
#

Syntax error, question expected

queen adder
#

So I have 0 exp in making a video game but I wanna try

rich egret
magic pagoda
#

heyy chat, me again uwu

how can I destroy the parent of the colliding object along with it here?

short hazel
queen adder
#

Nope

short hazel
#

Then check Unity !learn that will provide the required tutorials

eternal falconBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

short hazel
#

Do that if you want to start with Unity fast. I'd advise learning C# without Unity first though

queen adder
#

@short hazel thank you but I can't install Unity

magic pagoda
hidden sun
#

hi, im using unity cloud code and i use a subscription event. How do i disconnect from it ? in code?

rich egret
#

@swift crag Did you find the way?

queen adder
#

To be honest I was more looking for a long term collaboration with a Unity programmer

rancid tinsel
#

so if i understand it correctly this should result in the enemy being slowed during collision and then slowed again on collision exit for slowLength time https://gdl.space/busobareva.cpp

dawn kestrel
#

I thought "localCenter = gameObject.transform.position + center;" would give me a variable that is the world position of the object offset by the "center" public variable, but I'm still having my gizmo appear at the world origin.

swift crag
# rich egret

There is no line that says "EquipItem function called with item category: " before the error

eternal falconBOT
swift crag
fickle plume
swift crag
rich egret
swift crag
#

It absolutely matters. We need to see each log message in order.

magic pagoda
swift crag
#

Collapse will group them together in a way that prevents us from seeing exactly what's happening.

rich egret
queen adder
#

@summer stump thx ^^

rancid tinsel
swift crag
# rich egret

Yes, it's off now. Now show the results of trying to equip the items in that order.

dawn kestrel
swift crag
#

notably, there must be a line that says EquipItem function called with item category: visible -- that always gets logged before it tries checks how many items you have equipped

swift crag
#

unless you have code somewhere else that also prints the exact warning message you're seeing right now

fickle plume
magic pagoda
ruby python
#

In this video, you’ll learn more about object pooling, how it can provide performance optimization by reducing the processing power required of the CPU to run repetitive create and destroy calls, and how to use it in your Unity projects.

⭐ Learn more about programming design patterns in this e-book: https://on.unity.com/3O6tR8J
⭐ Check out Unit...

▶ Play video
swift crag
# rich egret

This does not make any sense, assuming that line 44 of EquipSystem is the only way for that warning to be logged. Your code has to go through the first few lines of the EquipItem method before it can even log anything.

#

If you click on that warning, is it actually coming from the EquipSystem class?

rich egret
rancid tinsel
#

im getting this when i exit playmode, would it impact the game at all if scenes were to change etc?

swift crag
#

you've showed us EquipSystem

#

the error is coming from ItemEquip

rich egret
swift crag
#

double click on your log messages to find out where they're actually coming from

rich egret
#

😂

short hazel
rich egret
#

@swift crag It's been two weeks since the problem started. Thank you!

dawn kestrel
#

what should I be using to get the Vector3 of the world position of the object my script is on?

short hazel
#

transform.position

#

That gets the world position

dawn kestrel
swift crag
#

Perhaps you are moving the object that BoxRegion is on after Start runs

short hazel
#

I knew there was a hidden question underneath that lol

swift crag
#

also, I don't know what boxTransform is

dawn kestrel
#

something I was gonna use for making a fully transformable gizmo, but decided better of it.

#

deprecated variable for now >.>

swift crag
#

something must be moving BoxRegion after its Start method runs, then

#

Perhaps someone else repositions them in its own Start method.

#

Instead of calculating the local center once, you should really just make a property that gives you the correct world-space center

#
public Vector3 WorldCenter => transform.TransformPoint(center);
#

"world center" is the appropriate name here: it's a position in world space

#

center is being interpretated as a local-space position in that line of code

rancid tinsel
#

would this work to not make the OnTriggerExit happen if an object was destroyed?

dawn kestrel
#

huh, it seems it was in fact the object not being in the right place at Start

swift crag
#

your problem would be the coroutine doing something after the target is destroyed

rancid tinsel
swift crag
#

what is line 28?

rancid tinsel
#

on the enemyMovementInstance.moveSpeed = line

swift crag
#

what if enemyMovementInstance is null?

#

maybe you hit a trigger collider that doesn't have an EnemyMovement on it

#

your script doesn't check if it actually got an EnemyMovement in the first place

#

Consider using TryGetComponent here.

#
if (other.TryGetComponent(out EnemyMovement enemyMovement)) {
  // enemyMovement will be non-null in here
}

// enemyMovement might be null out here
#

Actually, a more concise way is to just bail out if it fails

#
if (!other.TryGetComponent(out EnemyMovement enemyMovement))
  return;

// enemyMovement is definitely not null here
#

This creates a new variable as it calls TryGetComponent. It's passed with the out keyword, which lets the method assign something to your variable.

#

The method returns true if it succeeds.

#

So, if it returns false, we just return immediately

#

once we get past that check, enemyMovement is definitely valid.

rancid tinsel
#

so like this?

#

i assumed the issue was objects being destroyed and OnTriggerExit being called but it could be that the triggers were overlapping and triggering eachother now that i think about it

#

would explain the error being sent twice as well

swift crag
#

Actually, that is a good thought. I don't remember what happens when an object dies while overlapping.

rancid tinsel
#

either way now it will only do this if it gets the component

swift crag
short hazel
#

You're searching the component on yourself, not on other, make sure that's correct.

swift crag
#

oh, whoops

rancid tinsel
swift crag
#

Correct.

summer stump
#

OnTriggerExit does not get called when an object is destroyed inside the trigger area iirc

swift crag
#

(which is part of destruction)

#

It defaults to...i don't know

short hazel
#

Only if you expect the component to be on the object you triggered with, but seeing the context that's a yes

swift crag
#

looks like true

#

I'll have to experiment with that later

summer stump
#

Oh, that is good to know. Nice

rancid tinsel
swift crag
#

I guess I'd change if it was actually causing problems for me

#

note that you often will want to know about when an object is destroying while you're overlapping it

#

e.g. if you're keeping a list of things you're currently touching

rancid tinsel
#

but my headset got unplugged

#

lol

sterile loom
#

what's the point of using [SerializeField] private Transform instead of public Transform?

summer stump
swift crag
#

private fields can't be seen by other classes, which reduces clutter and reduces the number of ways class A can interact with class B

#

i'm actually fixing a bunch of public fields that shouldn't be public right now

ruby python
swift crag
#

Access modifiers matter more when you're writing code that other people will use.

#

But I consider "me from six months ago" to be another person entirely 😛

winter laurel
#

Im trying to figure out how to register a highscore? I have two scripts that already link up so that I can display my current score, but how do I register and keep a high score? Im guessing player prefs but I dont really know how to use those. The two pictures are my logic script, which is where i think im supposed to store the highscore and the collosion script for registering points.

swift crag
summer stump
swift crag
#

now you can't change the field without breaking everything

sterile loom
#

gotcha, also I got the animations working @short hazel 😄

#

still havent gotten around blend trees tho, need to read up on them I just ended up with a bunch of if/else scripts

ruby python
# winter laurel Im trying to figure out how to register a highscore? I have two scripts that alr...

PlayerPrefs is very easy to use tbh. But I know a lot of people think that they're a bad idea. But to get a high score, it's relatively simple really. Have a High Score variable, if the current high score is null then = it to 0, then on death or game complete etc. simple compare current score and high score, if current score > high score, current score = high score, else nothing, and then throw the new high score to wherever you're saving it. When you start the game again just read in the high score and assign it to the high score variable.

spiral narwhal
#
        private void OnEnable()
        {
            InputController.Instance.InputMaster.Player.SpawnCheckpoint.performed += TrySpawnCheckpoint;
        }

Any idea why the subscription does not call TrySpawnCheckpoint when F is pressed?

timber tide
spiral narwhal
#

OnEnable is called, yes

swift crag
#

I presume that InputMaster was produced with the "Generate C# Class" checkbox.

spiral narwhal
#

Yes

swift crag
#

Actions aren't enabled by default.

#

see the example code here

spiral narwhal
#

Ohhh yes I remember

#

Thank you

swift crag
spiral narwhal
#

This is from another project:

        /// <summary>
        ///     If the input controller script is enabled, the master is enabled as well.
        /// </summary>
        private void OnEnable()
        {
            Master.Enable();
        }

        /// <summary>
        ///     If the input controller script is disabled, the master is disabled as well.
        /// </summary>
        private void OnDisable()
        {
            Master.Disable();
        }

Is there a reason why they are disabled by default? Doesn't that just lead to lunacy like that?
I guess what I'm asking is, shouldn't the reverse be the default setting

timber tide
#

because

swift crag
#

maybe if you only have a single action map or something

#

(which is roughly how the PlayerInput component behaves -- it enables an action map for you)

#

but if you have a Walking action map and a Flying action map and a Driving action map, it doesn't make sense to have all of their actions firing all the time

spiral narwhal
#

🤷‍♂️ Maybe. But thanks for your help :D

rancid tinsel
#

is there a better way of doing this?

polar acorn
#

Also you could just use GetComponentInParent

rancid tinsel
#

as in its a child of a child of the object i want the script from

polar acorn
#

Pretty sure, tryitandsee

swift crag
#

if you change the layout at all, you suddenly can't find what you're looking for

#

you should try to just directly reference things you need

languid spire
#

also transform.root.GetComponentInChildren

wary dagger
#

why is that error appearing?

timber tide
#

open the prefab and make sure all scripts are intact

#

also try not crossposting

hidden sun
#

hi, how i can manually unsubscribe?

swift crag
#

If you use an anonymous function, you'll have to actually save that exact delegate and unsubscribe with it later.

#

An identical-looking anonymous function won't work, since they're two different instances.

hidden sun
#

i unsubscribe on a scene to resubscribe in next scene

swift crag
#

Yes. If you do this:

callbacks.Kicked += () => ...

then it's impossible to unsubscribe, since you don't have a reference to that exact delegate anymore

#

callbacks.Kicked -= () => ... would do nothing, because that's a completely separate object

#

I would create methods to replace those anonymous functions, and subscribe/unsubscribe those.

hidden sun
#

oh, ok ty

wary dagger
#

how would i go on and use the "highlight" variable in another if statement?

summer stump
#

Remove the var in front and just do highlight =

#

Make it either a variable declared just inside the first getbutton or a class variable

vagrant bramble
#

Hi, I have a question regarding animation frame when dialogue is activated.

This is my code: https://paste.ofcode.org/363FzMs62P4y8JDvSLW45Cg

I implemented animator enabled to be false to stop the animation but now when my character is sprinting or walking and I start dialogue, it pauses at the last animation frame in either walk or sprint mode.

Is there another way to implement the code so that it defaults to my idle animation and doesn't allow the player to do any movement keys once we are in dialogue mode?

timber tide
#

I think you should refactor your code then if you need to disable your animator to force idle position.

vagrant bramble
#

What does refactor your code means?

#

Or should I add a SerializeField for indialogue, and then let animator detect it is in dialogue and transition animation to a idle pose?

timber tide
#

means consider changing up your logic, because if your character isn't doing any actions, they should default into an idle state, no?

vagrant bramble
#

but how would I script it in here

vagrant bramble
#

since they can still walk but in a static position

timber tide
#

I'd first look into disabling input for that then

vagrant bramble
#

ok, so in this case I have to specific the move input to be disable right? else they can't press anything for dialogue to continue. I'll look that up

timber tide
#

if movement is tied to dialogue keys, then you could consider using a flag to determine if you should move the player

#

probably the most simplest way if you don't want to go into creating different input maps

wary dagger
#

why isn't the rotation part working at all? no errors or nun

pearl lodge
wary dagger
eternal needle
queen adder
#

what do i do?

timber tide
#

you look at the error and debug

queen adder
#

it says it cant convert float to a vector 3

summer stump
#

Either way, magnitude is a float

pearl lodge
queen adder
#

its a vector 3

#

does it need to be a float?

summer stump
#

Magnitude is a float though

queen adder
#

in this case im going to add it to targeted direction and apply that as a force to an object

pearl lodge
summer stump
#

You can add vectors together. You can't add a float to a vector (but you can MULTIPLY it)

queen adder
#

okay

#

im just a bit confused on what to do for my grab system

#

A guy was telling me to add magnitude to a direction

summer stump
#

You would multiply it in that case

#

They just used the wrong term

eternal needle
# wary dagger it always debugs 0

Finding out why that happens would be a good start, maybe say what you're trying to do in terms if your game though so people can suggest a better way

summer stump
#

Multiplying a vector by a float will change the magnitude while keeping the direction the same

queen adder
#

so how do i know what to multiply it by

modest dust
#

The first step would be to understand what you're doing

#

Both from a gameplay and math perspective

queen adder
#

i dont know im just confused

#

my goal is just to get a object to a target point physics based

covert sinew
#
        //Make a list of the empty objects in the GridLayout panel
        List<GameObject> _gridEmpty = new();

        foreach (GameObject child in GridLayout)
        {
            _gridEmpty.Add(child);
        }

Why is this throwing a InvalidCastException: Specified cast is not valid. error?

languid spire
#

presuming GidLayout is a transform then it's children are also Transforms

covert sinew
#

It's a GameObject with a RectTransform, and the child objects I want to destroy in it have normal Transforms.

languid spire
#

ok, show the declaration for GridLayout

covert sinew
#

Hold on, I think I might have fixed it, let me check.

wary dagger
covert sinew
#

Yeah, I managed to figure out what was wrong, thank you for the help.

wary dagger
#

why does the angle always debug to 0

rancid tinsel
#

does this look okay for animating the character based on their movement speed?

queen adder
#

how do i post code?

rancid tinsel
eternal falconBOT
rancid tinsel
#

i recommend the first one

#

gdl.space

#

really simple to use

modest dust
rancid tinsel
modest dust
queen adder
#

cool

rancid tinsel
#

oh yeah youre right

queen adder
#
 
 
if (Holding)
        {
            TargetDirection = TargetPoint.position - Grabbed.position;

            Grabbed.transform.GetComponent<Rigidbody>().AddForce(TargetDirection * 2f, ForceMode.Acceleration);



        }
queen adder
wary dagger
#

why does the angle always debug to 0

rich adder
queen adder
#

can somebody help me positioning a UI text in a sprites position

rich adder
sage mirage
#

Hey, guys! Why I see that instead of the text I want to activate?

sage mirage
#

Whenever my player enters the other trigger I want to activate the text inside the text component

rich adder
sage mirage
rich adder
rich adder
queen adder
rich adder
#

use WorldToScreen

queen adder
queen adder
rich adder
wary dagger
wary dagger
queen adder
rich adder
wary dagger
wary dagger
rich adder
sage mirage
rich adder
wary dagger
#

yh

#

how's that a problem tho

#

here btw

rich adder
#

yup prospective cam

wary dagger
#

do i change that to orthographic?

rich adder
#

do you not want depth in your game

#

are you doing 2D or 3D

wary dagger
#

yh but how else can i fix that

wary dagger
rich adder
#

with screentoray

dawn kestrel
#

is there a function that can find a new Vector3 by taking an old Vector3 and a quaternion?

south sky
#

Yo @rich adder you probably dont remember me but you helped me out before thanks

rich adder
queen adder
south sky
#

Anyone know if you can run scripts from instantiated prefabs on start?

rich adder
#

also prefabs dont run scripts

#

gameobjects do

#

prefabs are just "templates" to a gameobject

#

they arent a thing during runtime

rare basin
#

Can't understand something, maybe someone can help me out with it, i'd be glad. I am generating a grid via this code

    private void GenerateGrid()
    {
        gridCells = new RoomGridCell[gridSizeX, gridSizeY];

        for (int x = 0; x < gridSizeX; x++)
        {
            for (int y = 0; y < gridSizeY; y++)
            {
                gridCells[x, y] = new RoomGridCell();
                gridCells[x, y].roomIndex = new Vector2Int(x, y);

                if (y + 1 < gridSizeY) gridCells[x, y].top = gridCells[x, y + 1];
                if (x + 1 < gridSizeX) gridCells[x, y].right = gridCells[x + 1, y];
                if (y - 1 >= 0) gridCells[x, y].bottom = gridCells[x, y - 1];
                if (x - 1 >= 0) gridCells[x, y].left = gridCells[x - 1, y];
            }
        }
    }

then I have a startingRoom at index [7,7] in the grid. The gridSizeX and gridSizeY is both 15. I don't understand why startingRoom.top is null :/

        RoomGridCell startingRoom = gridCells[gridSizeX / 2, gridSizeY / 2];

        Debug.Log(startingRoom.roomIndex.y);
        Debug.Log(startingRoom.roomIndex.y+1);
        Debug.Log(gridSizeY);

        Debug.Log(startingRoom.top);
        Debug.Log(startingRoom.right);
        Debug.Log(startingRoom.bottom);
        Debug.Log(startingRoom.left);
queen adder
rare basin
rich adder
#

is your game top view ?

wary dagger
#

45°

south sky
rich adder
# wary dagger

There weren't any tutorials on using the Plane struct in Unity, so here it is.
Introduction to Planes: 0:00
Creating a Plane: 01:43
Finding the Closest Point on a Plane: 4:06
Finding a Point's Side on a Plane: 6:06
Finding Ray Intersections on a Plane: 8:32

Unity Plane Documentation: https://docs.unity3d.com/ScriptReference/Plane.html
Fish AR ...

▶ Play video
dawn kestrel
# rich adder what?

Let's say there's a sphere whose center is 0,0,0, and I've been given a point on the surface of the sphere in the form of a Vector3, and a rotational translation applied to the sphere in the form of a quaternion. Is there an existing Method that I can call to find what the new Vector3 location of the point would be?

rich adder
queen adder
#

ok wait its converting

#

want to see scripts?

modest plover
#

hello how do i make a window that changes graphics settings before opening game

rich adder
#

maybe someone else knows

rich adder
south sky
#

I want a box to be instantiated at a random point out of 2 positions set on a prefab when the prefab is instantiated, anyone have an idea how I code this. I dont now how I would reference the coordiante positions of the 2 points that are in the prefab

rich adder
#
MyScript myObject = Instantiate(etc...
var someVariabel = myObject.MyPublicVariable```
same as
```cs
GameObject myObject = Instantiate(etc...
var someVariabel = myObject.GetComponent<MyScript>().MyPublicVariable```
queen adder
#

oh wait i see one problem let me fix it and see

rich adder
#

isnt this script on the pieces?

queen adder
#

yeah did that, check the second link but the problem is same

rich adder
#

no i know but its wrong

queen adder
#

pieces scripts

rich adder
#

yes but you want the textPop

queen adder
#

yes, when the piece is clicked

rich adder
#

yes but you're doing GetComponent

#

rectTransform = GetComponent<RectTransform>();

#

this is wrong if the script is on the piece

queen adder
#

its not on the piece

rich adder
#

you need the rectTransform of the text

queen adder
#

this is on a text

rich adder
#

so why does it have OnMouseDown ?

queen adder
queen adder
rich adder
#

when you send a script dont omit the class name etc.

queen adder
#

ohh wait

rich adder
#

theyre both the same script..

#

just changed up

queen adder
rich adder
#

like their pivot n stuff

queen adder
#

maybe its cuz of canvas settings?

#

cause i tried scaling it with screen size so it fits on every screen but it actually has no point in that case

rich adder
#

yeah maybe you need to account canvas scale

#

iirc it just worked for me last time

#

have you tried regular .position =
instead of anchored pos

#

just curious if it prob is canvas scaling messing with it

queen adder
#

yesss thankssss

#

how was that shit so easy ive been sitting here for 3 hours

rich adder
#

it worked?

#

nicee

queen adder
#

yes yes

swift crag
#

anchoredPosition is relative to your parent.

rich adder
#

ahh true

queen adder
#

and what is localPosition then?

rich adder
#

relative to parent but world coords, the anchoredPos is the position from anchor

swift crag
#

localPosition doesn't care about the anchors (which determine whether or not your RectTransform stretches)

#

I'm a bit fuzzy on the details. I need to go play around with that a bit.

kindred stratus
#

How can I make my 8 directional character controller 4 directional

queen adder
#

is there a way to Instantiate the gameobject youre firing the script from?