#💻┃code-beginner

1 messages · Page 652 of 1

wooden star
#

i did a very similar thing in another project and it worked compleatly fine

rich adder
#

your TimerScript doesn't seem to exist

wooden star
#

referencing another script

rich adder
#

where is TimerScript ?

wooden star
sour fulcrum
#

thats not how it works

#

does TimeScript exist in your project

rich adder
#

declaring a variable has nothing to do with a type existing

sour fulcrum
#

(also if it doesn't exist in your project it's certainly not going to be attatched to an object in your scene)

rich adder
#

its like you trying to use a word in autocorrect that doesnt exist in the dictionary

#

when you declare its just saying " I want to store a TimerScript here "
computer is saying "What is TimerScript? I have no idea"

wooden star
rich adder
#

we dont see your setup

wooden star
rich adder
wooden star
rich adder
#

the filename is completely unrelated to whats defined inside

wooden star
#

ah is it because i renamed it?

rich adder
wooden star
#

i fixed 2 errors

#

thats the only one now

rich adder
#

it would not make much sense to do so as an array has no such method

#

only components have GetComponent methods on them

#

You probably want the Singular version GetObjectWithTag not Objects

sour fulcrum
rich adder
#

also if you just want that 1 script you can just link it in the inspector no?

wooden star
#

ngl i didnt realise i said plural mb

rich adder
#

[SerializeField] TimerScript timer

#

then drag n drop

#

you already used it for TMP I see

wooden star
#

would it still work when the timer script is linked to another game object

rich adder
#

ofcourse

#

as long as they are part of the same scene

#

other methods otherwise you can check link above it has alternatives if you have to find runtime / spawned objects or referencing a scene object from prefab

wooden star
#

ive sorted all the syntax errors but now i can get this to work

#

the timer reaches 0 and the character is still there

rich adder
# wooden star

these dont give much context to where this line was placed and whether or not its running

wooden star
rich adder
#

you are keeping characterAlive bool track in 1 sript, and then another script, just because they share the name they are NOT the same at all

#

each script has its own copy of the bool

wooden star
#

is there away to make them share it

rich adder
#

several ways

wooden star
#

do i just reference the script i want the bool for before hand

#

if (TimerScript.characterAlive == false)?

rich adder
#

the cleanest way would be to reference the timer script and only follow the timer from there

rich adder
#

the timer is only a timer, thats all it should do..track the time

#

if the player cares about the timer going to 0 then you follow the currentTime from the player

#

and logic from there

wooden star
#

i have it so when the timer runs down to 0 it kills the characted

rich adder
#

mhm I understand what the usecase is

wooden star
#

but if theres another way for it to do the exact same thing?

rich adder
#

track the value of currentTime there or use a bool from timer

#

eg
if(timerScript.isTimerOver)
//do stuff

#

ideally you use events but here its okay to use Update since you're new

#

so you switch up the bool in the TimerScript from characterAlive to IsTimerOver or whatever

#

then in player update you check the value

wooden star
#

so scripts share data types exept bool?

rich adder
#

scripts only share something public when you access it

#

they are not global values or anything

#

thats why you have to make a reference to it

#

the datatype is irrelevant

wooden star
#

i think what im strugaling with is my lack of knowlege on referencing

#

This is another project where i tried the same thing and it worked

#

But it doesent work here

slender nymph
#

because in the first one you are using a variable that happened to have the same name as the class. the second you are just directly using the class instead of your variable

#

you should consider stopping what you are doing and go through the beginner c# courses pinned in this channel to get a better grasp of the basics instead of trying to brute force it

wintry quarry
#

And note you are using JumboJoe in the code, not JoeScript:

#

this is correct, you are using the variable name correctly.

#

In the other one, you are trying to use the type name.

fading barn
#

do i need to multiply my force vector which i am passing in rigidbody.addforce method by time.deltatime if the function is being called in fixed update?

slender nymph
#

no, you should not be multiplying your forces by deltaTime. The forcemode you choose will take that into account if necessary

#

and you should also never be adding force in Update with the exception of one-off forces, they should always be done in FixedUpdate to ensure they are consistent (especially considering the rigidbody is only ever updated on FixedUpdate frames anyway)

prime goblet
#

i'm handling a groundcheck using this method, however it ALWAYS returns false! (like the player is in the air)

            if (_jumpAction.WasPressedThisFrame()) {
                if (Physics.SphereCast(groundCheck.position, 0.5f, Vector3.down, out RaycastHit hit, 0.5f, playerLayer)) {
                    rb.linearVelocity = new Vector3(rb.linearVelocity.x, jumpForce, rb.linearVelocity.z);
                }
            }

edit i solved it by using checksphere!

sleek flare
#

Thank you, I'll move it there.

unique olive
#

Hello not sure if this is the right place to ask but
I have a question on how to keep on track of the scripts you make,
are there any good standards on how to make memos of how each scripts connects and works?

cuz I have like 10 C# scripts in my projects & it's getting hard to get back on track whenever I come back after a break

prime goblet
#

however you like

#

here's an example of mine, but it's always up to your preference

eternal needle
prime goblet
#

i decided to use CheckSphere instead

eternal needle
#

Ah it was edited as I hit enter

prime goblet
#

oof but thanks anyway

ivory bobcat
prime goblet
#
            bool isGrounded = Physics.CheckSphere(groundCheck.position, 0.5f, mask);

            if (_jumpAction.WasPressedThisFrame() && isGrounded) {
                rb.linearVelocity = new Vector3(rb.linearVelocity.x, jumpForce, rb.linearVelocity.z);
            }

this was my new solution (yes i know i can put it directly into the statement but i reuse it directly after)

eternal needle
prime goblet
#

nope, it's literally a walk around the place game

eternal needle
#

I meant that because your current logic would let you jump if there was a wall beside you

#

Theres no way of checking what the slope of the ground is here

unique olive
# prime goblet sort them in folders

Actually I meant like how to keep a document on how the script works
like ex.)EnemyManager: Spawns 1 enemy every 10 sec + Calls someGameObject,
PlayerHP: Spawns HP UI, if hp0 = play animator "dead"

All that kind of information, I was wondering if there's an easy way to keep a memo of all of em/or
like make it easy to read for other devs to get in the project too

prime goblet
#

comments

#

// or /* */ for comment blocks

#
/*
* HEADER
* this code does x
* this code does y
* changing z modifies w
*/```
prime goblet
#

i added your log statements to my original problematic code, it knows jump was pressed but never acknowledged the player's ability to jump

eternal needle
prime goblet
eternal needle
#

Usually your files shouldnt be that large, so it wouldnt really take much for a dev to skim through it and have a basic idea of what it's doing. Comments are there to explain what isnt easily understood. Code should be written in a way in that its understood immediately

#

And when organizing the code into folders based on what its solving, there wont be that many classes to go through and understand.

#

There isnt really a built in tool otherwise to solve what you're describing if you're trying to get a dev caught up on the whole project. Youd likely just want to make some basic diagram

sour fulcrum
#

draw.io or something can be nice for that

unique olive
#

I'll take a more look on how to sort my folders, I did sort them in a few genres like GamePlay/UI/etc but seems like I could go more deep on sorting them out

prime goblet
sour fulcrum
#

my message was an extension of bawsi's

unique olive
#

Actually draw.io was something I was expecting lol but I learned we didn't really use flowcharts

#

Thank you all so much

eternal needle
eternal needle
sour fulcrum
#

Not sure if this helps at all but a misc. diagram ive made in the past to visualise that kinda thing

#

i had nicer looking ones somewhere but they have poofed

#

kinda cooked but was semi helpful too

unique olive
#

So then
Class diagrams = See how everything is linked (mainly in complex stuff
Code explanation = comments and sorting them more specific
I'm still a noob dev didn't know how everyone sorts it out

unique olive
sour fulcrum
#

Ideally a majority of code is written in a way that makes comments unneccasary

#

Depends what it is though

#

A lot of the time a comment can be really handy if you decided to do something a certain way because another way did not work and your comment explains that your not doing it that way because of whatever reason

unique olive
#

don't punch me but I've been learning code through unity's tutorials until I came across Claude's ai code gen
which made reading/understanding all codes a pain in the neck

#

not knowing this really feels like ai is rather making it hard to code either way

sour fulcrum
#

no ones gonna crucify you for using AI but you can't ask for help with ai code on this server and most active members strongly believe it harms in learning rather than helping

unique olive
#

I believe you're right, cause the mindset is starting to be learning code → make the code done(which is tough to do without learning) after using ai, its no easy way through

naive pawn
prime goblet
#

it's not against the rules unless you havent tested it or noted such but it's a hrorible idea

rich scroll
#

I regularly use AI to help me understand a topic better, then I go and check if its correct. To generate code, but then I go and try to understand why it generated that specific code and if it has problems or not. And so on

#

The problem is not with AI, its usually the users

naive pawn
#

but why not just skip the middleman and go to known reputable sources lol

rich scroll
#

Cause sometimes the source doesnt explain it the way an AI can

naive pawn
#

The problem is not with AI, its usually the users
true, but it's much harder to instruct people to "use it efficiently" lol
genAI is just very inconsistent

#

basically, it's a beginner trap

#

it has its uses, but it's much, much more likely to be misused, whether intentional or not

rich scroll
#

Have you ever looked into the unity docs? Half of it feels like noone actually cared about it and literally just wrote down what the arguments to a function are, and didnt provide any examples

naive pawn
#

you don't actually gain anything by using a chatbot

rich scroll
#

Thats why I then go and check if that example is correct

#

And why its correct

naive pawn
#

how do you check it if there's no example?

#

there are examples, just not in the unity docs; so again, just skip the middleman and go to those lol

rich scroll
#

The ai gives an example, which I can then try out and figure out what its doing

naive pawn
#

you're just creating more work for yourself 😆

rich scroll
#

Yeah, cause finding a source is as easy as that

#

Sometimes its not

naive pawn
#

it is, really

#

this topic has been exercised to death already, the concensus isn't going to change

rich scroll
#

Im not trying to change it

naive pawn
#

the recommendation to beginners will stay the same: don't use chatbots, you just end up stunting your learning experience

#

chatbots are a tool, one that you need experience to navigate and use correctly

#

beginners, by definition, don't have that experience

rich scroll
#

How to use it

naive pawn
#

if you advocate using chatbots to beginners, you are actively hurting them

rich scroll
#

Not just dont use it its bad

naive pawn
#

you just add another unnecessary step 😆

#

and that interrupts the actual useful learning

hexed terrace
# rich scroll How to use it

It's not the 'how to' that's the main issue - it's that "ai" will give incorrect code, and beginners don't have the knowledge to know what's wrong, won't understand it, and won't learn anything about coding.

rich scroll
# naive pawn you just add another unnecessary step 😆

I don't think it does, if you know how to use it. But if everyone is telling you to never even touch it, you'll never know how to use it. Like you said, its a tool. Tools can be super useful, but it has to be learned, just like the 'actual relevant topic' has to be learned.

#

I'm on the train with you all, that it shouldn't be the first thing to go to

#

but if you never even try it cause everyone is saying its bad, you'll never know how to use it properly

naive pawn
#

does one have to know how to use it properly? what is it even good for lol

#

i digress

#

it's just not a tool for beginners

#

it shouldn't be learnt alongside the other skills

#

you need to already have those other skills to be able to filter through all the bullshit it will spawn

rich scroll
#

I personally find it really useful for small things

naive pawn
#

it is, objectively, a harmful tool when learning

hexed terrace
#

by time you're at a level of knowledge to be experienced enough for ai to be... ok to use... you're no longer a beginner.

naive pawn
#

it's a masquerade of a source of truth

#

so to put it bluntly; sure, maybe genai has a place. but it absolutely does not have a place here, in #💻┃code-beginner

rich scroll
naive pawn
#

and if you know how to use it, you aren't in the learning stage

rich scroll
#

eh, yea thats probably true

naive pawn
#

just to make sure we're on the same page; the issue is not the question of learning to use genai, the issue is about beginners learning to use genai

rich scroll
#

I know, but I still wouldn't 'scare' beginners into never using it cause it's bad. I'd say use it when you know more

naive pawn
#

it is, still, pretty bad as a source of truth anyways

rich scroll
#

depends on what you want it to do

naive pawn
#

thonk "when you know more" to a beginner would just be the next day lol

rich scroll
#

I know

#

I just didn't want to write a whole list of things to know

naive pawn
#

anyways another point; you have to have a certain level of experience in general to be able to handle the output
you should see the absolute pain it is to deal with people who use that shit and are surprised when it doesn't work lol

#

it's just much easier for us, the community, and the learner, a beginner, to just stay away from genai

#

don't give a benchmark for them to start using ai lol

rich scroll
#

oh yea I know, its mainly the younger people

naive pawn
#

it'll backfire to hell

rich scroll
#

I'm not giving them a benchmark

naive pawn
#

anyways still; recommending genai in any capacity in a support space just isn't going to be productive for anyone involved

abstract copper
#

Getting the error MissingMethodException: Method 'PlayerController.OnMove' not found. When using the new input system

    public void OnMove(InputAction.CallbackContext context)
    {
        moveInput = context.ReadValue<Vector2>();
    }

I have this method in a script on the same gameobject that has the player input component and the component has behavior it send messages, i checked the action and map name both are correct.

naive pawn
rich scroll
#

yea, either change the sendmessages to Unity events, or the arguments to InputValue

naive pawn
#

so you'd need to have something like this instead

public void OnMove(InputValue val) {
  moveInput = val.Get<Vector2>();
}
abstract copper
#

Oh lol thanks, first time using it even tho i should have long time ago

hollow wraith
#

Any recommendations to fix an issue with my jittery camera?
I think the issue is that the player position changes, which messes with the camera's movement speed to catch up with the player, but I'm not entirely sure how to address that as an issue.

wintry quarry
eternal falconBOT
hollow wraith
wintry quarry
#

And you need to make sure it's moving and rotating only via the Rigidbody, never the Transform

hollow wraith
#

I'll change up the code so it works with Rigidbody over Transform

#

💜

honest haven
#

Having a issue with a button i have private IEnumerator SetSpinButtonSelectedNextFrame() { yield return null; // wait 1 frame EventSystem.current.SetSelectedGameObject(null); EventSystem.current.SetSelectedGameObject(spinButtonTenCoinsGameObject); Debug.Log("Selected GameObject: " + EventSystem.current.currentSelectedGameObject?.name); } to set the current selected button as highlight. the console shows the button as current select gameobject like so . but the sprite swap is not working and if i press enter it does not work. So what would stop this from working

naive pawn
dry pulsar
#

So i am doing that script:

But it wont work with "Random"

naive pawn
wintry quarry
#

Change it to UnityEngine.Random

naive pawn
#

so does that make sense to you

#

just remove the using System; at the top

wintry quarry
#

Or that

dry pulsar
#

Ty guys

noble cedar
#

guys could someone help me how do you create JSON using code and also encrypt it so players cant modify it

brave compass
noble cedar
wintry quarry
noble cedar
#

I believe

wintry quarry
#

Worst case scenario they can just use Cheat Engine or similar to modify the data in memory

#

If you want the data to not be modifiable by the player it can't live on their computer, you would need to store it in the cloud

noble cedar
wintry quarry
#

then you have to accept that the players will be able to modify it

#

which isn't a problem

noble cedar
wintry quarry
#

nobody cares if someone cheats at solitaire

wintry quarry
#

which defeats the purpose

noble cedar
wintry quarry
#

that is an online game

#

and progress is stored online

#

(i think, i never played it)

#

assuming it's online multiplayer

noble cedar
wintry quarry
#

but your progress is still stored in the cloud

noble cedar
wintry quarry
#

they use a hybrid approach no doubt

noble cedar
wintry quarry
#

almost certainly not json

#

probably a custom binary format

#

but JSON is really irrelevant to the discussion

#

it's just a data format

#

it's orthogonal to the discussion of where the data is stored and if and how it's encrypted

noble cedar
wintry quarry
#

orthogonal == "irrelevant"

#

not directly applicable

#

a different discussion

noble cedar
#

so what would you recommend me using to store player data? if I want to have database and offline storing?

wintry quarry
#

basically just a local save file of some kind that gets synced to the cloud and gets validated by your server if and when it gets synced to the cloud

#

as for how validation works (i.e. "was this earned legitimately") that's a pretty hard problem in and of itself

exotic hazel
noble cedar
wintry quarry
noble cedar
#

@wintry quarry what if I made like that by each update the storage would get version up and if the version stays the same but values change in database and the file where the data is stored then players would get banned idk for 1week for playing with files

exotic hazel
noble cedar
obsidian holly
#

heeyy (idk if i put this here but honestly im desperate, just lmk if im wrong) so as i am a beginner, i made a game over the course of 4ish weeks.. (its 2D and bad) but the point was to use it for my study in one of my classes (so it doesn't have to be like expert level or anything). issue: it works perfectly fine when in Unity (ykn) and I published it to several different (free) websites to try to make it into an actual web browser game. I wish I knew what question to ask but im just confused at what the issue is... i've researched and researched, so I guess I need help with the publishing aspect and how I can actually make it into a 2D web-browser game? (I can explain more if someone helps, its a whole thing)

drifting vale
#

you mean publishing and then having it public so other people can play it?
Continue with your current message that you're typing and then react to this xD

wintry quarry
obsidian holly
#

its so hard, let me try

exotic hazel
#

another thing. the inspector is correct but when i run the game it becomes like this. and i dont understand why

#

2nd image is how it becomes

wintry quarry
#

Do you have a custom editor for this script?

obsidian holly
# wintry quarry You'd have to explain what goes wrong in the build

explanationish: in unity, my game runs pretty fine when I test, no errors come up, seems as the title screen works + my instructions screen (for the study), my buttons are clickable, and the score works perfectly fine. so, after, what I did was I made my game into that web browser build, I seem to have a correct scene list to my understanding, then i have the zip file which I put into several websites (that are free, so unfortunately its itch.io and game something i forget), and I put in the correct file+ stuff for it to be a browser only type game.. now, when I open the game in my browser, it wants to play, but I am met with a blue screen and only one of my UI is working (which happens to be the round UI so it says "round 1/4") and it stays there, nothing happens-- no title screen/instruction screen. I occasionaly see my button (that the people can click) pop up but its one and stops.

exotic hazel
#

or not that i know of

wintry quarry
wintry quarry
obsidian holly
drifting vale
exotic hazel
#

so restarting wont work

obsidian holly
#

I was thinking it doesnt matter too much if it was just named web?

drifting vale
obsidian holly
drifting vale
#

Its a screenshot from my Build Settings tab

#

File>Build Settings

obsidian holly
#

that was another thing I saw to troubleshoot but I only have build profiles and to my understanding thats the same thing as build settings?

#

when i click file*

drifting vale
#

ah I see, has been renamed I guess, Ill create an unity6 project rq to see whats there

obsidian holly
#

ohh I see what you are talking about, development build at the bottom. I should click that and see the errors? (where would I see the errors also?)

#

(ive been troubleshooting for hours im buffering lol)

drifting vale
#

Yeah, enable that box, then make an new build and try running that. Then whenever you go to your browsers console and see what errors you get. I have not used the Dev mode on a web build myself yet, so I wont know wxactly what I would look for.

wintry quarry
drifting vale
#

console: ctrl+shift+c / ctrl+shift+i most of the time

obsidian holly
#

my games taking forever to build for some reason lol but yea ill do this

shut swallow
#

It's probably some indenting problem because it worked before

obsidian holly
quick pollen
#

how can you interpret this formula in unity?

#
        float g = Physics.gravity.y;
        float v = 45;
        float d = Vector3.Distance(transform.position, targetPosition);
        angle = 45 + 1f/2*(float)Mathf.Acos(g*d/(v*v));```
this is my attempt at it, but it doesn't work
#

(this is the formula for the angle of reach at which a projectile must be launched in order to go a distance d, given the initial velocity v.)

#

I'm basically trying to create a mortar

wintry quarry
#

You need to convert it to degrees

quick pollen
#

oh

#

shit

#

that makes more sense

#

I was given values between like 0 to 1

#

well not exactly but yea

quick pollen
wintry quarry
#

Math.Rad2Deg is the constant to multiply by

quick pollen
#

oh theres Rad2Deg yea

quick pollen
wintry quarry
#

Nope

shut swallow
#

it's just 180/pi

wintry quarry
#

It's just a number

shut swallow
#

between rad and deg

quick pollen
#

also, how can I calculate the minimum velocity required to hit a point?

#

I couldn't find a formula for that

shut swallow
quick pollen
#

I mean

#

the mortar will always be looking toward the enemy

#

so I can ignore the Z variable

shut swallow
#

man i just learnt this not long ago

#

gimme a sec

quick pollen
shut swallow
#

lemme check notes

quick pollen
#

I'm also having issues actually like

#

rotating the object

#

the red ball on the cube is meant to indicate which way is forward

#

but rn it just does this

#

transform.rotation = initialRotation * Quaternion.Euler(new Vector3(angle, 0f, 0f));

#

o shit actually it works

#

I just needed to subtract 180 degrees from it

shut swallow
#

@quick pollen

#

since the cannon is always facing the object you can do this

#

and if you need to find the distance you can do Vector3.Distance

#

i assume that the angle of the cannon is fixed right?

#

btw u is the velocity, |u| is the magnitude of the velocity

#

but it shouldn't matter since u should be positive anyways

#

Oh yea I should remind you

#

This angle is in radians iirc

#

also one more thing

#

this equation breaks when there is a differance in y level between the two objects

shut swallow
#

well

#

that's complicates things a bit

quick pollen
#

I mean

#

I'd need both the speed and angle to be variable

#

and I always want the steepest angle and lowest velocity

shut swallow
#

alright

quick pollen
#

I already have the formula for the steepest angle

#

but I need to be able to calculate the velocity beforehand

shut swallow
#

so before you know the angle or after

#

if after you know the angle

#

you can just plug the angle in the equation I just gave out

#

that returns minimum velocity

quick pollen
#

i need it before

shut swallow
#

alright

quick pollen
#

tho wait

shut swallow
#

classic hs math

quick pollen
#

technically I can just plug in the distance as the speed?

#

I mean

shut swallow
#

that doesn't work in projectile motion

quick pollen
#

it would guarantee a possible angle, no?

shut swallow
#

yes?

quick pollen
#

i think thatd be fine

shut swallow
#

if you like shoot directly at it, sure

#

but like if you shoot at an angle

quick pollen
#

I updated the formula 45 + 1f/2*(Mathf.Rad2Deg * Mathf.Acos(g/d))

#

instead of g*d/v*v I substituted v for d

shut swallow
#

it wouldn't work if you're looking for steepest angle and slowest velocity

quick pollen
#

simplified the d next to the g

#

and it works fine

shut swallow
#

ight then

#

lmfao

quick pollen
#

what matters is that its guaranteed to hit, and doesnt try to fire in a straight line

shut swallow
#

lmfao

#

i mean yea that works

quick pollen
#

now I need to find a way to also make it look towards the player

naive pawn
quick pollen
#

the mortar, i mean

naive pawn
#

that's the angle for which you get maximal distance for a given speed

shut swallow
#

thanks

quick pollen
#

transform.rotation = initialRotation * Quaternion.Euler(new Vector3(angle - 180, 0f, 0f));

#

right now I do this

#

but I need to make sure it looks towards the player

#

theres Quaternion.LookRotation, yes

naive pawn
quick pollen
#

but I only want to change the y and z rotation

quick pollen
#

I mean, honestly it doesnt matter too much

#

as I said, I just wanted to avoid cases where the projectile either flies for wayyy too long, or is aimed directly at the player

#

using the distance made it so it takes more time to get there depending on how far you are

naive pawn
# quick pollen but I need to make sure it looks towards the player

maybe this doesn't really apply, but the direct solution i can think of is just having 2 nested GOs
the parent represents the mortar as a whole, and rotates about y to point towards the player
the child represents the barrel, and rotates about x to angle the barrel up

quick pollen
#

lemme test that

shut swallow
#

I'm thinking of getting the angle difference between the mortor and player

quick pollen
#

that exists, yes

naive pawn
quick pollen
#

but that doesnt sound like it

quick pollen
#

but idk how

#

I only need the Y angle from the lookrotation

#

I guess i can convert to eulerangles and take it from there?

naive pawn
#

transform.rotation = Quaternion.LookRotation(Vector3.ProjectOnPlane(target.position, transform.up))?

#

wait i don't think that's how ProjectOnPlane works one sec

quick pollen
#

im trying smth else wait

#

I tried this float playerAngle = Quaternion.LookRotation(targetPosition - transform.position).eulerAngles.y;

#

not great

#

transform.rotation = initialRotation * Quaternion.Euler(new Vector3(angle - 180, playerDirection, 0f));

naive pawn
#

i mean you're working directly from rotations to rotations

#

why go through eulerangles and back

quick pollen
#

for the LookRotation?

#

o wait you're right

#

transform.rotation = initialRotation * Quaternion.Euler(new Vector3(angle - 180, playerDirection + 90, 0f));
this works tho

#

actually i can get rid of the 90 and 180

naive pawn
#
Vector3 target = player.transform.position;
target.y = transform.position.y;
transform.rotation = Quaternion.LookRotation(target);
quick pollen
#

I just need to change the initialrotation

naive pawn
quick pollen
#

so it both looks toward the player and is also angled so if a projectile is fired, it hits the player

naive pawn
#

so this would just be the y rotation

#

and then you'd compute the x rotation with trig on the other GO

#

or i guess if you have a single object and (for example) just make it point up 45°, could do something like

Vector3 target = player.transform.position;
target.y = transform.position.y;
transform.rotation = Quaternion.LookRotation(target) * Quaternion.Euler(45, 0, 0);
quick pollen
#

that does look tidier, lemme test that

#

also, how could I go about making it so something is always looking in a specific direction, regardless of its parent?

#

as an example, make something always look towards exactly down, without caring about the parent?

naive pawn
#

set its rotation in LateUpdate, i guess?

quick pollen
#

target is a position, not a direction

shut swallow
#

can't you just set rotation?

quick pollen
#

you need to do targetPosition - transform.position

quick pollen
#

i wonder if theres a way to do it without code

#

with like a constraint

naive pawn
quick pollen
#

you've already helped a lot

shut swallow
#

expose the argument in a script [SerializedField, Range(0f, 1f)] private Quaternion setRotation and then apply the rotation on start?

#

then you can just edit that rotation in editor

naive pawn
# quick pollen target is a position, not a direction

though FromToRotation does take 2 positions, could use that ig
so either:

Vector3 direction = player.transform.position - transform.position;
direction.y = 0;
transform.rotation = Quaternion.LookRotation(direction) * Quaternion.Euler(45, 0, 0);
```or```ts
Vector3 target = player.transform.position;
target.y = transform.position.y;
transform.rotation = Quaternion.FromToRotation(target, transform.position) * Quaternion.Euler(45, 0, 0);
shut swallow
#

is it dynamic is my question

shut swallow
#

oh yea

#

it's rotation

#

but should still be able to edit it no?

#

gimme a sec lemme try sth out

naive pawn
slender nymph
naive pawn
kindred iron
#

oh didnt see mb

naive pawn
#

oh wait hold on, the serialization rules thing isn't an exhaustive list

shut swallow
#

you can expose it with [SerializeField] private Quaternion rotationSet

quick pollen
#

I think I figured it out

shut swallow
#

and then you can set the rotation

#

in code but only need to be called once

#

and you can edit your values in editor

shut swallow
#

the projectiles linger a bit after they hit the ground

quick pollen
#

thats okay

#

I just forgot to make them disappear on impact

shut swallow
#

and the mortor rotation looked a bit off

#

but looks fine

quick pollen
#

it looks a bit weird, yes

small sparrow
#

!cs

eternal falconBOT
quick pollen
#

but it seems to do it normally

#

I would kinda like to make it so it goes faster and falls faster too tho

#

I guess I can double the gravity

#

no that doesnt work

#

if I go too close it just breaks

#

I get a negative sqrt

jolly stag
#

Hello, I was wondering if I could get a bit of help with some code. I'm trying to get a trigger to activate when the player goes into it and holds the space bar. I unfortunately can't see what I'm doing wrong. Thanks!
' private void OnTriggerEnter(Collider other) { if (other.CompareTag("Mantle") && Input.GetKey(KeyCode.Space)) { mantleCheck = true; } }

quick pollen
#

when you enter the trigger

#

oh wait

#

are you sure that the collision is actually registered?

#

you should debug that first

polar acorn
quick pollen
#

how can I make an object fall faster?

#

changing the mass doesnt seem to change anything

jolly stag
jolly stag
naive pawn
quick pollen
quick pollen
naive pawn
#

fall time isn't affected by mass

shut swallow
#

lmfao

quick pollen
#

what is it affected by then? surface?

jolly stag
quick pollen
#

no thats not right

shut swallow
#

which includes angle

quick pollen
#

i thought heavier objects fall faster than lighter ones?

shut swallow
#

no

polar acorn
shut swallow
#

v = u + at

quick pollen
#

man im tired lmao

jolly stag
#

Thank you @quick pollen and @polar acorn you're life savers for newbies <3

shut swallow
#

velocity is independent from mass

quick pollen
#

how could I make it fall faster then?

polar acorn
#

Mass affects terminal velocity, but not acceleration

polar acorn
shut swallow
#

acceration which is gravity

naive pawn
# quick pollen what is it affected by then? surface?

the forces involved - gravity and drag
the force of gravity is proportional to mass, so it stays a constant acceleration
drag is proportional to velocity squared and the cross-section (though in unity these aren't considered, it's also just a constant deceleration)

quick pollen
polar acorn
shut swallow
quick pollen
#

yeah drag would also make it slow down on the x axis

#

not just the y

shut swallow
#

you either AddForce or just adjust the gravity variable imo

quick pollen
#

as I said, I tried doubling the gravitational constant

#

but it messes things up

shut swallow
#

what's your eqn

quick pollen
#

if I get too close, I get a negative square root

shut swallow
quick pollen
quick pollen
#

which is kinda stupid, but it semi works

naive pawn
#

where's the square root

quick pollen
naive pawn
naive pawn
quick pollen
#

oh

#

whoops

naive pawn
#

it's about something not being normalized

#

-# where is the "negative" part from lol

shut swallow
#

i think it's because of the acos function

#

normally when we do acos, we take domain 0, 2pi no?

naive pawn
quick pollen
quick pollen
quick pollen
#

I know it has nothing to do with playerDirection

#

this was an issue before I added that

shut swallow
#

I mean -1, 1 mb

naive pawn
#

acos would have domain [1, -1] and range [0, pi]

naive pawn
quick pollen
#

yeah

#

so whats the issue I wonder

#

oh I mean

#

I know what the issue is

naive pawn
quick pollen
#

g/d is not between that

shut swallow
#

lemme look at acos in unity

quick pollen
#

playerDirection is a float

#

which is a kinda misleading name now that i think about it

naive pawn
shut swallow
quick pollen
#

but it was always off

#

it never hit the player

naive pawn
#

uhh that's not what i mean

#

Quaternion.Euler has an overload for float x, float y, float z

quick pollen
#

oh?

naive pawn
#

so you can do Euler(angle - 180, playerDirection, 0)

quick pollen
#

dang, didnt know that

#

thanks

#

I always assumed it only had Vector3

quick pollen
naive pawn
#

a lot of functions have that kind of thing

naive pawn
shut swallow
#

yea acos domain is -1,1

#

which ig g/d breaks

naive pawn
shut swallow
#

when g is large enough

naive pawn
#

why are they different

quick pollen
#

so for some reason g is too large yeah

quick pollen
shut swallow
naive pawn
quick pollen
#

thats just 180 / 3.14 yeah

shut swallow
#

idk

quick pollen
polar acorn
#

Hard-coding that one probably gives a more precise answer than letting the division do it

naive pawn
#

love it

shut swallow
#

i think bc unity spits out angles in rad normally so they use a set value

polar acorn
#

Remember: Floats are significantly more dense near 0.

quick pollen
#

anyway, back onto the calculation thing, so its 100% that i cant use the distance for calculating the velocity

polar acorn
#

pi / 180 is in the range of "there's a lot of numbers here to use"
180 / pi is not

quick pollen
#

but idk what I could actually use

shut swallow
naive pawn
quick pollen
shut swallow
#

yes

#

that is the main problem

quick pollen
#

so idk what you mean by vector decomp calculations

shut swallow
#

when you solve projectile motion, you solve for the original vector by decomposing the x and y vectors given the range

#

and vice versa

quick pollen
#

yeah...?

naive pawn
#

thonk give me a sec

shut swallow
#

which is a bit tedious to say the least

quick pollen
#

yeah im a bit confused lmao

#

I just wanna make it so the time it takes to reach the player is linear with the distance

naive pawn
#

ok so that's proportional to the velocity but it's not equal

#

that would take into account the angle

quick pollen
#

yeah

#

i mean

#

angle no

#

only distance

naive pawn
#

it would, yes

#

it would take into account the angle

shut swallow
#

t = 2u sin theta/g

#

if you're looking for the time

quick pollen
#

i mean, i dont need the time specifically

naive pawn
#

ah

quick pollen
#

what I mean is

#

I want to make it, so if you are x distance from the enemy, the projectile reaches you in x * y amount of time

naive pawn
#

ok what exactly are the variables in this scenario?

shut swallow
naive pawn
#

as in, what can you change

quick pollen
#

basically guarantee that the player is always hittable

naive pawn
#

you want t to stay constant over s

#

what can change, v and a?
presumably g stays constant, right?

quick pollen
naive pawn
#

what

#

no

#

between each shot

quick pollen
#

I mean

#

oh

#

the angle and the velocity

shut swallow
#

should be v and angle

#

yea

quick pollen
#

and the velocity is proportional to the distance

naive pawn
#

uh no

quick pollen
#

sorry

naive pawn
#

ah

quick pollen
#

problem is

naive pawn
#

yeah that comes with time being constant

quick pollen
#

if the distance is too low, then I acos breaks

#

because velocity also becomes too low

#

a.k.a. it cant find an angle at which is reaches it, because the projectile falls to the ground too fast

shut swallow
#

I mean like Chris said before you can just let angle = 45°

#

Or pi/2 radians

naive pawn
#

or just set some other constant

#

that makes it a lot easier

quick pollen
#

for the angle?

naive pawn
#

for a mortar that might be 60°

quick pollen
#

ohh wait

#

I get it

shut swallow
#

then now you only need some distance for velocity magnitude

quick pollen
#

yeayea

#

I mean

#

i feel stupid for making all those calculations

#

and now it being useless

shut swallow
#

lmfao

#

I mean i wrote this down earlier lol

shut swallow
quick pollen
#

One can also ask what launch angle allows the lowest possible launch velocity. This occurs when the two solutions above are equal, implying that the quantity under the square root sign is zero. This, tan θ = v2/gx, requires solving a quadratic equation for

#

wait this isnt it

#

I would want to make it so the angle is based on a velocity maybe?

#

problem with that is itd be the opposite of what i want

#

itd take longer the closer you were

#

instead of longer the further you were

naive pawn
#

you're overcomplicating it

shut swallow
# shut swallow

ight its like 1am in aus imma tap out first, but you can always set velocity for angle and angle for velocity if you use this equation

naive pawn
#

just set a constant angle

#

so the horizontal speed and velocity stay relatively consistent

#

as in, v_x = kv

#

k being cos(a)

quick pollen
#

If I make the angle be a constant, then I need to calculate the minimum velocity required to hit the player

naive pawn
#

no it's just. 1 exact value

shut swallow
#

it's 1 value

naive pawn
#

v = sqrt(-2sg/sqrt3)

#

(assuming gravity is negative)

quick pollen
shut swallow
#

x is distance, u is inital velocity and theta is angle in radians

naive pawn
#

initial velocity

quick pollen
#

gimme a sec

#

i can do this maths myself i think

#

what's a tho?

naive pawn
naive pawn
shut swallow
#

a is acceration which is gravity

quick pollen
#

ahh

#

okok

#

fuck its rotated

#

whatever

shut swallow
#

yea looks right enough

quick pollen
#

does it matter if its in rads or degs?

#

it shouldnt, right?

shut swallow
#

yes

#

it does

quick pollen
#

I need to convert it later anyway

naive pawn
#

it does for the function you use in code

shut swallow
#

it's in rads

quick pollen
#

yea thats what I mean

naive pawn
#

degrees is just a constant, π/180

quick pollen
#

I can just convert the output of the sine to degrees

naive pawn
#

uh.. no?

shut swallow
#

oh yea nvm double angle works on deg too

#

lmfao

shut swallow
#

v is in a number

#

not some angle

quick pollen
#

oh

#

yea

#

so wait

#

Mathf.Sqrt(d*g/(float)Math.Sin(2*angle))

#

this is it, no?

#

angle is a deg tho

#

not a rad

#

but it shouldnt matter

naive pawn
#

then convert it lol

naive pawn
#

when you actually. yknow. give it to something else

quick pollen
#

why do I need to convert the angle to rad?

naive pawn
#

because Sin expects rad

quick pollen
#

then I have to convert the sin to deg too?

naive pawn
#

what?

#

sin doesn't output an angle

quick pollen
#

oh wait

#

fuck this is sin not asin

shut swallow
#

sin takes a rad input and spits out a value

#

lmfao

quick pollen
#

im stupid

naive pawn
#

aren't we all

shut swallow
#

fair enough

quick pollen
shut swallow
#

a bracket killed my code

#

and I spent like 30 minutes to find where i fucked up

#

love it

quick pollen
#

i did smth similar like that too an hour ago

shut swallow
#

peak

quick pollen
#

i was so confused

#

float v = Mathf.Sqrt(d * g / (float)Math.Sin(2 * Mathf.Deg2Rad * (angle + 180)));

#

pemdas issue maybe?

#

nope

#

idk what it is wait

naive pawn
shut swallow
#

why is v a float

quick pollen
#

I mean

#

rb.velocity.normalized * v

naive pawn
quick pollen
#

it worked before for d

quick pollen
#

its looking into the ground

shut swallow
quick pollen
#

and I'd rather work in degrees

naive pawn
shut swallow
#

usually that happens when you plug a float in

quick pollen
naive pawn
#

how did you define g in

quick pollen
#

oh

naive pawn
#

that'll be negative

quick pollen
#

fuck

#

right

naive pawn
#

that's why it was the wrong direction

shut swallow
#

can you just

naive pawn
#

it needs to be flipped, not rotated 180

shut swallow
#

g = 9.8

quick pollen
#

and thats why it was nan

#

because the sqrt had a negative value in it

shut swallow
#

angle + 180 is in quadrant 3 or 4

#

answer is a negative

#

it's not about the square root

quick pollen
#

that wasnt the main issue

#

it was about the sqrt

#

distance is positive

#

I made it -Physics.gravity.y and it no longer does that shit

shut swallow
#

think of this: negative divide by negative is positive

#

top and bottom are negative

quick pollen
#

i fixed it

#
        d = Vector3.Distance(transform.position, targetPosition);
        float v = Mathf.Sqrt(d * g / (float)Math.Sin(2 * Mathf.Deg2Rad * angle));
        float playerAngle = Quaternion.LookRotation(targetPosition - transform.position).eulerAngles.y;
        transform.rotation = Quaternion.Euler(angle + 180, playerAngle + 180, 0f);```
#

not exactly intuitive

#

but if i dont do this i get a negative sqrt

shut swallow
#

Yep the v is now correctly written

quick pollen
#

thank you @shut swallow and @naive pawn for the help!
guess i learned quite a bit of physics

naive pawn
#

(on the Sin call)

#

that's why you're getting a double instead of a float

quick pollen
#

oh

#

good to know :)

quick pollen
shut swallow
quick pollen
#

and those formulas?

naive pawn
#

those are pretty basic kinematics

shut swallow
#

Yea

quick pollen
#

my physics teacher is an ass

#

i need to learn all this by myself

#

and im not saying this as like a rebel

shut swallow
#

In projectile motion at the top of the parabola, velocity in the y direction is 0 and half of total time has passed

quick pollen
#

he straight up threatens you if you ask a question

shut swallow
#

🤨

naive pawn
quick pollen
#

yes?

shut swallow
#

Ight it's 2am here

naive pawn
#

that aint a teacher

quick pollen
#

what is it then

naive pawn
#

an asshole with a degree

quick pollen
quick pollen
#

fr tho

#

I had to get into quantum mechanics without him

#

I just started doing gamedev and such on his classes

#

and he gets mad that im not looking at the presentation hes reading

#

others are just playing videogames or sleeping

#

at least i do smth productive

#

and somewhat physics related

#

I like physics a lot, and I am trying to learn it, mainly through gamedev rn, I just hate him, and it discourages me from even trying when he gets mad that I don't know the formulas stuff like, idk number of oscillations over x time
(rant over, sorry for off topic)

noble cedar
#

can someone tell me what is bigginer code like
would linking JSON to Database looking the data and uploading to each other whatever has higher value
would count as begginer code or should I go to advance or general?

naive pawn
noble cedar
naive pawn
#

@quick pollen anyways here's a (relatively) brief explanation coming from the basics

  • a velocity 𝑣 with an angle 𝛼 to the plane can be split into 2 components, 𝑣ₓ = 𝑣cos𝛼, 𝑣ᵧ = 𝑣sin𝛼
  • the time it takes to travel back to the same plane: v = u + at (final velocity = initial velocity + acceleration * time)
    • when it comes back down it'll be the same speed, but in the opposite direction
    • -𝑣ᵧ = 𝑣ᵧ + 𝑔𝑡 ⇒ 𝑡 = -2𝑣ᵧ / 𝑔
  • the time it takes to travel some distance - s = vt (displacement = velocity * time)
    • 𝑠 = 𝑣ₓ𝑡
  • ⇒ 𝑠 = 𝑣ₓ * -2𝑣ᵧ / 𝑔
  • ⇒ -½ 𝑠𝑔 = 𝑣ₓ𝑣ᵧ
  • ⇒ -½ 𝑠𝑔 = 𝑣²sin𝛼cos𝛼
  • sinAcosA = ½ sin2A
  • ⇒ -½ 𝑠𝑔 = 𝑣² ½ sin2𝛼
  • ⇒ 𝑣 = √(-𝑠𝑔/sin2𝛼)
#

i probably didn't have to do the full working, huh...
idk, just a habit lol

quick pollen
#

tysm for the explanation!

#

i think i get it

#

(ngl i usually use integrals to calculate displacement, but if the velocity is linear then it doesnt matter ig)

#

also ngl i didnt know you can split a velocity vector into 2 components like that

willow raptor
#

I am insanely new literally just started like 20 mins ago what did i do wrong trying to do some movement stuff

#

watching a tutorial

naive pawn
#

you didn't open the method

willow raptor
#

huh

naive pawn
#

look at the tutorial code closer, you haven't followed it accurately

polar acorn
#

{ } you dropped these

willow raptor
polar acorn
#

What do you mean "they didn't come up"?

#

They come up when you type them

willow raptor
#

last time they came up automatically

polar acorn
#

It'll make an end brace when you type the start brace

naive pawn
#

and.. what's the issue with typing them yourself

willow raptor
naive pawn
#

you didn't add { }, that's what you did wrong lol

willow raptor
#

i know

#

can i just paste them in

naive pawn
#

...why

solid heart
#

yea

naive pawn
#

just type them lol

willow raptor
solid heart
#

yea you can copy and past them

naive pawn
#

what keyboard are you using

#

braces are used very often

willow raptor
naive pawn
#

relying on copy/paste will be a pain

naive pawn
#

this isn't a control key

#

it's not removed by being 60%

willow raptor
#

idk where they are but ill just paste them for now

naive pawn
#

is it qwerty?

polar acorn
#

Just like... look at your keyboard

#

and find the buttons

naive pawn
#

{ is shift+[, } is shift+]

polar acorn
#

You're not going to be pasting braces for the entirety of your time programming

polar acorn
#

can you not look down

naive pawn
#

just find them

#

why do you want to make life harder for yourself

night mural
#

maybe python is more your speed?

willow raptor
#

im going to paste them once

naive pawn
#

for dicts and sets

willow raptor
#

and then ill man up and find it

polar acorn
naive pawn
night mural
#

looking down intensifies

willow raptor
#

i found them but i dont know what combination

night mural
#

try doing like 2 hyphens and a bar |

#

and then rearrange them and squish them

naive pawn
naive pawn
night mural
#

hey they said they found them already

willow raptor
keen cargo
# naive pawn

to be completely fair to them, it entirely depends on the keyboard language

naive pawn
#

you didn't answer

#

so i assumed lol

willow raptor
#

im not a nerd so i dk

#

just joking

naive pawn
#

this isn't a nerd thing

#

what language is the keyboard for?

willow raptor
#

norwegian

keen cargo
#

try R-ALT + 7 for {, R-ALT + 0 for }

that's what works on my Finnish keyboard

ivory bobcat
night mural
#

sometimes you're too busy being the semunGOAT catshrug

naive pawn
keen cargo
#

yep thats the one

#

mine looks exaclty like it

willow raptor
#

are u norwegian

keen cargo
#

no, finnish

naive pawn
# naive pawn this one?

the symbols on the right of each key are for altgr
so it's altgr + 7 for { and altgr + 0 for }

willow raptor
#

ooh

#

omg

#

i did it

#

fouind it

keen cargo
#

well ok i'm not "finnish", i live in finland

but yes you need to know how to enter your own braces

willow raptor
#

chris your a savior

#

a legend

naive pawn
#

i mean.. did you not know how to use altgr before?

night mural
naive pawn
#

ah yeah didn't notice 🐌

night mural
#

altgr? what are we, dogs?

naive pawn
keen cargo
#

alt grrr

night mural
#

alt meow catcomf

willow raptor
naive pawn
#

this isn't a nerd thing

#

this is how to use a keyboard

night mural
#

sounds like a nerd to me

keen cargo
#

how to use keyboard tutorial, 2025, free, no virus

naive pawn
#

such a low bar 😆

rocky canyon
#

lol.. everyone here is a nerd

#

maybe not a geek

willow raptor
#

my goal is to become a nerd thanks to chris for bringing me 1 step closer

polar acorn
naive pawn
rocky canyon
#

my IRL friends dont know i have a discord 😉

keen cargo
rocky canyon
#

thats a good step 👍

keen cargo
#

since you had issues with the code not working without braces {}

naive pawn
keen cargo
#

you should know the basics from here

willow raptor
#

ill try it later thanks boss

keen cargo
#

go through that, and then !learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

ripe galleon
#

can i use a script macine and a state machine a t the same time when i do code a 2d game with visual scripting?

slender nymph
ripe galleon
#

script machine

#

thanks, i will join it and ask there

slender nymph
#

and "script machine" means what in this context?

polar acorn
ripe galleon
#

you have a code in the script machine, but i did see that the state machine also does use codes(nodes) in the tutorial

keen cargo
#

do you mean the IDE??

polar acorn
#

It looks like "Script Machine" is a visual scripting component. No one here is really going to know what that is

#

We use code here

ripe galleon
#

ok, i just wanted to answer to the question boxfriend asked

keen cargo
#

oh yeah just looked it up, it's all visual scripting stuff

slender nymph
keen cargo
#

i remember my first project's teacher said to use visual scripting for a state machine lol...

#

i did not end up doing that

ripe galleon
slender nymph
keen cargo
#

true, i just remember he was being really vague about it, i looked up visual scripting and got turned off immediately lol

torn verge
#

I don't know if this is the right place to write this but I'll post it anyway. I have a problem with battle scenes conflicting with my overworld scenes. My "game" is a game with multiple rooms/scenes and I use DDOL on my player to retain my player position when switching scenes. Basically I make a door that change scene then I make position the scene where the door is, so when I switch back scene I spawn at the door. But I wanna make a battle-arena scene that appears when encountering an enemy. And I want my player to be in the same position that it was before the battle after the battle is over. Could I possibly store the player position then teleport to it after the battle is over? How would I do this?

#

BTW I want my player to be in the battle-arena scene since Im going to be able walk around and dodge the enemy's attack in this case the "Flame enemy" lol

rocky canyon
#

Could I possibly store the player position then teleport to it after the battle is over? How would I do this?
not sure y u couldn't? something like a gamemanager keeping track of where the player will spawn bakc into.. jus like the DDOl stuff

torn verge
#

Is there a better way to this?

rocky canyon
#

ur player gets spawned in correct? couldnt be on the player.. u said u have some DOOL stuff.. could possibly cache it and use it there

torn verge
#

My player is in the DDOL stuff

rocky canyon
#

well if ur player sticks around.. and ur not instantiating it in..
u could probably put a variable on it and change it as needed

#

then when u need to reposition him or w/e u just read from its variable

#

next time u go thru door or into battle.. just give the player his "returning position"

gentle charm
#

im trying to do multiplayer, i've pretty much done it all its just getting it so when the 2nd player spawns it doesnt take over the camera

lapis sentinel
#

hye im a beginner in unity and utilize this software in my daily work. Im trying to be prepared if given task related to unity. I have been discovering the unity for 1 month.

The issue i had with unity is when writing c# script. How to find the directory name and its related class because some directory or should i say Meta sometimes does not have an up to date documentation about the directory i want to use . Soo how does the big shot and pro league manage to get their hands to utilize this scrambled documentation and directory.

#

sometime the class name i use does not recognize the directory im ising although it stated in the doccumentation

slender nymph
#

what do you mean by "the directory" in this?

gentle charm
#

how do i fix this

slender nymph
gentle charm
#

oh, i just figured since it was on the same machine it didnt need any wouldn't be networking related

grand snow
slender nymph
gentle charm
#

true

slender nymph
#

if you are trying to do local multiplayer then you don't need a networking library so you're doing it wrong anyway

torn verge
grand snow
#

Then thats a flaw and you should not use DDOL OR hide it during this