#Cursor lock and camera issue
1 messages · Page 1 of 1 (latest)
@distant parrot we made a thread
So if I am understanding correctly, you can still see your cursor even though you set it to hidden or whatever?
now my camera is starting way way above the position I am setting it to
it isn't hidden nor is it locked so yeah I can move it and it's visible rn
Are you sure your script is getting called?
And did you try it in build, not editor as well?
I am pretty sure as I can move the camera with my mouse now
and yeah trying it in game
Build, not editor play mode, right?
No
where do I do that?
File > Build Setting
i dont even remember tbh
can you put a Debug.Log in start
Wow, that was a quick build
see if it runs
I have to go, sorry
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveCamera : MonoBehaviour
{
public Transform cameraPosition;
void Update()
{
transform.position = cameraPosition.position;
}
}
I don't think this script is working
the position is not being updated
is it because the void update isn't private?
idk
what do you mean by this?
I built and ran it if that's what you mean
private void start()
{
Debug.Log("BingBong");
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}```
wait
wait
ah
wtf
??
configure?
yes !ide
If your IDE is not autocompleting code
or underlining errors, please configure it:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code*
• JetBrains Rider
• Other/None
*VS Code's debugger plugin is unsupported.
We recommend using VS or Rider instead.
I don't notice any difference
you really don't ?
S vs. s
ok good ur half way there,
did u select it in unity as editor
and restart VS
Oh hey perfect
The mouse is gone!
thanks lads
got another issue now if ya got the time tho haha
hey listen if the IDE(VS) was configured it would've def alerted you
so for sure configure it , as it is also the rules
c# is case sensitive
maybe , show it
open script from unity
let it load
screenshot
wdym second option
you have VS2019 yes?
did you do this part
Yeah I am on there I got either Visual Studio 2019 or Visual Studio Code
I used to use vscode, and it never worked, but then I switched to just plain vs, and everything did fine
maybe that's the issue
I am pretty sure I'm on code
Yep it shows them!
Thanks lads
Can I make it black?
tools > theme
not sure if it still like that in 2019
Yay! I helped someone!
community?
Free version
I like free
indeed, you likely downloaded enterprise trial

What. On earth. Is that?
catto
it's catto!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveCamera : MonoBehaviour
{
public Transform cameraPosition;
private void Update()
{
transform.position = cameraPosition.position;
}
}
Why does this not work?
It looks like a cat with a broken smile and Christmas lights on it's cheeks
what you mean "doesn't work"
Wait
good question
The code is running
my print("Big Balls"); worked
The position is not being changed
What!?
What!?
😦
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveCamera : MonoBehaviour
{
public Transform cameraPosition;
private void Update()
{
print("Big Balls");
transform.position = cameraPosition.position;
}
}
Big Balls
so what "doesnt work" mean
transform.position is not being set equal to cameraPosition.position
but what I don't get
where tf am I getting transofmr
transform
you checked in inspector if the xyz values change in camholder?
I know where I am getting transform
Their value did change
but
It's wrong
I don't understnad
It's like
ALMOST being moved correctly?
it is moving with the character
but has
some weirdass offset
show hierarchy
how did you check that the coordinate is off?
This is the camera's position
This is the CameraHolder's position
Why do they both have camera gizmos?
does it still happen if u start it with other script disabled
yes
the position is still off
so I guess the rotation isn't causing the issue
watch it be another capitalisation error
You configured your IDE, so it shouldn't be a typo
But why that?
I wanted to see if the code was running
Or are you asking if there's a reason as to why I specifically used "Big Balls"
Yes, that was the whole "What!?" thing
Subconscious reason
Your neurons fired in a way that made you type that
Ok, I think we drove off @distant parrot
Me too
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveCamera : MonoBehaviour
{
public Transform cameraPosition;
private void Update()
{
print("Big Balls");
transform.position = cameraPosition.position;
}
}
it sets
transform.position of the thingy
to
the position of the position
huh?
I went throu the early 2000s
Try saying this.transform.position = randomPos (note: this is pseudo code)
alright
See if it works
this has no knowledge of position
position comes from transform
Fixed
pos = new Vector3(x, y, z);
private void LateUpdate()
{
transform.position = cameraPosition.position;
}``` try
Wait, can you even update transform.position directly?
yes
It's been like a month or two since I actually used unity
Doesn't work
This is odd
can you show the debug gizmos in playmode
Even I don't know what this refers to
But I feel like I should
What
How do you make those show up in play mode?
[SerializeField] Transform posToGo;
void Update()
{
transform.position = posToGo.position;
}```
I don't see that
ok
Wtf
WAIT
FUCK ME
maybe not
I was thinking
Either
Yeah
I am a silly sausage
Ok so the issue is
Ffs
the parent is offsetting child
yes?
the CameraHolder is moving as it should
but the camera inside of the PlayerCam isn't moving
no yes
literally exactly what you said
oh ok lol so it working now?
Yes
I set the position values of the camera to 0,0,0
so it was inside the parent
haha
thanks for the help man
I am not at all used to Unity yet
Yeah
Was where I started making games
I am proud of that
No harm in starting somewhere
Just another place to utilise creativity
nothing wrong wit it no
But it's definitely way more user friendly and less complex
code is pretty easy once you learn the components
all the functions are pretty much in the engine already
Yeah seems that way tbh will just take a hot minute to figure out what's where
Does blender really have a game engine?
yup. always look through the docs
Good thing we made a thread
its been a while since it did
uh
They got rid of it?
so I attached my character controller script
dont think so no
Yes?
My bean is wildin'
are you following a tutorial or just doing stuff ?
What?
because you still do need fundamentals lol
look into movement tutorials no
I managed to learn C# through unity tutorials somehow, but I also knew python
Unity has specific c# methods yes
always good to learn the basics of c# itself too
I did that after
It could be worth just working my way through all of the unity tutorials a few times before I continue
will be tomorrow's problems
Unity learn?
check the pinned in #💻┃code-beginner as wel, they have decent older ones code wise
I started that once, but knew everything it was saying, so stopped. Will finish sometime in the unspecified future
yes its for mostly those who never touched unity at all
@wary crystal sorry, but I won't be accepting your friend request, nothing personal
What were we talking about again? Did all problems get fixed?
I've got to go, bye!
I do not care ❤️

