#💻┃code-beginner
1 messages · Page 183 of 1
How does ToggleRadgoll work?
but it goes back to idle and real quick into attack
i just saw a tutorial of unity radgolls and i dont understand why it dont gets recognized to me
ToggleRagdoll ?
that sounds like a custom thing
Ragdoll methods are not a thing
should the else if allow collision again?
i mean that it doesnt, but idk whats wrong
If you're trying to do IgnoreCollision inside ONCollisionEnter2D, you're too late, it already collided
Ohh
this is how it suppsoed to look
it actually does work, just that i cant turn on collision again
well this is OnCollisionEnter2D
if there's no collision anymore, that won't be happening anymore
what are you trying to accomplish
fireball cannot interact with archers, but if the player reflect them, then they can hit and destroy archers
just move it into a different layer after it reflects
and set up layer based collisions
but then i have to keep track what goes in which layer
if i can handle each case in code, i can be more sure aboitu stuff
you can change layers via code
I'm talking about handling it in code
i know but like for example the fireball, the player and the archer.
player and archer should interact
player and fireball should interact
player and reflected fireball should not interact
archer and reflected fireball should interact^
now imagine u have a few others thing too, how would u keep track of which layer is for what
Seems pretty simple. Four layers:
- Player layer
- Enemy layer
- PlayerProjectile layer
- EnemyProjectile layer
when the archer shoots, the fireball starts in the EnemyProjectile layer
When the player reflects it, it moves to the PlayerProjectile layer
EnemyProjectiles interact with the player and not with enemies
PlayerProjectiles interact with enemies and not with the player
🧐
so now the only thing you have to do in the shield code is:
void OnCollisionEnter2D(Collision2D collision) {
if (/* collided object is a projectile we can reflect*/) {
GameObject projectile = collision.collider.gameObject;
projectile.layer = MyLayerHelper.PlayerProjectileLayer;
// code to actually reflect the projectile direction here
}
}```
I searched it and I didnt get a few things
{
transform.position = new Vector3(Player.position.x, Player.position.y, Player.position.z);
transform.parent = Player.transform;
Hammer.SetActive(false);
isEquipped = true;
}```
I want to make it so you can pick up the ball (what the script is on) and drop it, i need a bool to tell if the object is equipped or not, which is the isEquipped. its set to false at the beginning of the game. when i dont have the isEquipped part in the if statement, code works fine, but when i have it in, it doesnt work. I put a debug log in the if statement to see if it fires and it doesnt. anyone know why?
fyi:
transform.position = new Vector3(Player.position.x, Player.position.y, Player.position.z);```
Can just be:
```cs
transform.position = Player.position;```
Searched what
where am I supposed to store that, and can I use it together with unity event?
getting the nullReference error again with the player.playersPosition 🙁
i swear i tried that and it didnt work but ill try it again
thanks
it's identical
Google it
You wrote isEquipped = false when you should have written isEquipped == false or better yet just !isEquipped
ooh okay
isEquipped = false ASSIGNS it to false
let me try that
it doesn't check if it's false
oh okay i see
Also you should be using && not & almost always
&& is more efficient
it will skip the second check entirely if the first one already is false
alright well the !isEquipped work
okay thanks :)
Im doing it, just asking should the interfaces be made in the powerup script or a seperate script, and should it be on the scene or not?
You can have a power up mono behaviour
That implements IPowerup interface
And when you collide with IPowerup just trigger PerformPowerup() interface method
And each of your power up could have different implementation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class PowerUps : MonoBehaviour
{
[SerializeField]UnityEvent powerup;
public PlayerHealthSystem playerHealthSystem;
void Start()
{
playerHealthSystem = FindObjectOfType<PlayerHealthSystem>();
}
void Update()
{
}
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.CompareTag("Player"))
{
powerup.Invoke();
Destroy(gameObject);
}
}
}
can I keep this as base for it?
ok so inside this code I would create an interface
perhaps they dont know what interface does lol
so like MonoBehaviour, Ipowerup?
Yes
okok
{
transform.position = Balla.position;
transform.parent = Balla.transform;
Hammer.SetActive(false);
isEquipped = true;
}
if (isEquipped == true && Input.GetKeyDown("e"))
{
transform.position = new Vector3(Player.position.x, 2, Player.position.y);
transform.parent = null;
Hammer.SetActive(true);
isEquipped = false;
}```
So the top if statement works, lets you pick up the ball as intented, but when i put the bottom if statement in, which should let you drop the ball and re-equip the hammer you can no longer pick up the ball, any idea why?
i apologize for asking loads of questions that probably have simple answers im just kinda not good at this LMAO
if (Input.GetKey(KeyCode.LeftControl))
{
Vector3 downwardThrust = Vector3.down * verticalSpeed * Time.deltaTime;
transform.Translate(downwardThrust);
} does some1 know why i go down with scroll wheel if i add this piece?
Put a log inside thatt
whats verticalSpeed
public float verticalSpeed = 3f;
then scrollwheel would have no effect here
but it does
well not in the code you showed.
but it does
it doesnt reach the debug...
well not in the code you showed.
we can go in circles all day
I just didnt understand how this will make it work, Ive seen interfaces are good to call the same function from even if its on different scripts. But Im just trying to call a method from a script that is in the scene by a script that is a prefab. I could just make a switch case and list all the functions called depending on the type of powerup. But I think that something like a unity event would be more organised so I didnt need to make the powerup script too full.
then the collider you hit doesn't have the Fireball component on the collider gameobject
put one outside the if statements and see what object you're colliding with, if any
Or the first if is executed
or OnCollisionEnter2D isn't running at all
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Also you should've mentioned that verticalSpeed gets adjusted by GetAxis
although don't think scroll wheel at all affects that
question: if i post a question and no one answers about how long should i wait until its society acceptable to ask again
cuz i dont want to be that guy who spams my question 20 times waiting for an answer
I shown you how to do that no with the link I've sent?
just reply to the old post if its been longer than 10min or flooded
Wait at 10 minutes or until it's off the screen, whichever is slower
well its long off the screen so
anyone know?
Because the bottom one is going to run immediately after the top with how your code is
you are setting isEquipped = true
ah okay that makes sense
how do i fix that
logs this when touching the ground n das all
print the name
not the component
ight let me try that
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
how do i get the name again?
I would restructure the code like this:
if (Input.GetKeyDown("e")) {
if (isEquipped) {
transform.position = new Vector3(Player.position.x, 2, Player.position.y);
transform.parent = null;
Hammer.SetActive(true);
isEquipped = false;
}
else if (distanceToPlayer.magnitude <= PickupRange) {
transform.position = Balla.position;
transform.parent = Balla.transform;
Hammer.SetActive(false);
isEquipped = true;
}
}```
.name
oh yah, Im sorry I have it in an open tab let me look at it better
okay thanks
faced one problem where:
for (int i = 0; i < StatusList.Count; i++)
{
if (StatusList[i].duration == 0)
StatusList.Remove(StatusList[i]);
}
After removing that StatusList[i] the list is getting smaller and well... that kinda screws the purpose.
How do I actually remove all expired items from the list without screwing up?
StatusList.RemoveAll(s => s.duration == 0);```
+ `using System.Linq;`
bruh i alr tried that it gievs this
okay i have an issue but ill try to fix it myself first
omg pastebin sucks, should've used the ones from bot messages..
Anyway nothing here seems to be grabbing input from the ScrollWheel 🤷♂️
ill come back if i cant solve it LOL
Why is this code not able to get these game objects into the array
leeet me try that 🙂
they're not active. GameObject.Find doesn't work with inactive objects.
also you should read about disabled objects
any way to make this work on disabled objects?
just make serialized fields for them
How about just:
GameObject dropsParent = GameObject.Find("Drops");``` or just assign it in the inspector
Then you can iterate over the parent object as you please
GameObject.find is trashy in general
https://docs.unity3d.com/ScriptReference/Object.FindObjectOfType.html has an inactive flag
foreach (Transform child in dropsParent.transform) {
// whatever
}```
the issue is that my character with the script spawns so instantiates mid game
if you really need runtime just find a "holder" object that has them in an array
ok well - the code I showed above shows how to get around that
like PraetorBlue suggested
but I would still Opt for a Component find instead of name
if you ever changed names your whole system breaks
Drops dropsParent = FindObjectOfType<Drops>();
RemoveAll is a part of System.Collections.Generic though )
{
if (isEquipped)
{
transform.position = new Vector3(Player.position.x, 2, Player.position.y);
transform.parent = null;
Hammer.SetActive(true);
isEquipped = false;
}
else if (distanceToPlayer.magnitude <= PickupRange)
{
transform.position = Balla.position;
transform.parent = Balla.transform;
Hammer.SetActive(false);
isEquipped = true;
}
}```
alright i cant figure this out so basically it all works, but when i drop the ball instead of dropping at the players feet like it should, it drops at its original spawn point when you start the game. the player gameobject is correctly assigned in the inspector btw
the player variable is correctly assigned in the inspector
player gameobject i mean
I have gotten a little comnfused due to my inexperience so ill go do some research on the things you guys suggested, thanyouuu
oh then yeah, that, nevermind on the using part then
I will try though
basically a component is a Script, usually Monobehaviour
So you find the object that holds all your drops in a list
its more solid to look for a Component(Script) than a name of an object
ok so it doesnt even count the collision with the fireball, even tho its on the same layer as the energyball
show current script rq
thank you, that worked
archer script
fireball
the layer changes correctly, i checked that
by pausing the game
Where's your Debug.Log? You need to put one between line 19 and 20
after its reflected
between 19 and 20? there is a debug on like 20 tho
in the first screenshot
sorry still not following
Ok I think I might be blind
are you sure you're not setting collider to IgnoreCollision or something
anyone have a clue?
why 2 btw
u mean here or script?
well there isnt in the script
i had removed it
oh ok i was looking at old code then
thats just the y value of the ground
i want it to spawn on the players feet basically
so same x, same z, but on the ground
wouldn't it be easier to make a transform at players feet and spawn it there?
using 2 seems too arbitrary
also iirc thats worldpos
Which if statement isn't working?
yea
easier Imo than magic number guess
whats happening is when you drop the ball instead of it spawning at the players feet it spawns at its original spot
should i record a video to show
Which if statement?
I assume transform.position = new Vector3(Player.position.x, 2, Player.position.y);
1st if statement is the dropping, the 2nd is the picking it up
the 1st isnt working
yeah im sure thats the issue
i just dont know why or how to solve it
you put y instead of Z
https://paste.mod.gg/nhbuazqvveaj/1
https://paste.mod.gg/nhbuazqvveaj/2
like here r the scripts i ncase i missed something or somethign
A tool for sharing your source code with the world!
A tool for sharing your source code with the world!
Log the players position and see if it's the expected position.
If it's correct, consider setting the parent before changing the position.
where does it spawn, when it spawns pause game press F on keyboard
alright
it spawns at 0, 0.71, 0
okay yeah the debug is correct
maybe you want transform.localPosition since its parented to player still
i put the parent line before the position line im still getting the same issue
or just unparent first
oh no it doesnt
the balls positions stays at 0, 0.71, 0
Debug.Log(Player.transform.position); i just put that in update
{
if (isEquipped)
{
transform.parent = null;
transform.localPosition = new Vector3(Player.position.x, 0.71f, Player.position.z);
Hammer.SetActive(true);
isEquipped = false;
}
else if (distanceToPlayer.magnitude <= PickupRange)
{
transform.position = Balla.position;
transform.parent = Balla.transform;
Hammer.SetActive(false);
isEquipped = true;
}
}```
i put the parent line before and i made it localPosition
pls 🙏
Why do you need to change the position at all when dropping it?
because it should drop at the players feet. when equipped its in the players "hand"
but the ball position doesnt actually change it just becomes a child of the player (when picking it up i mean)
if (isEquipped)
{
Debug.Log($"Initial: Ball position {transform.position}, Player position {Player.position}");
transform.position = new Vector3(Player.position.x, 2, Player.position.y);
Debug.Log($"Changed: Ball position {transform.position}");
transform.parent = null;
Debug.Log($"Unparented: Ball position {transform.position}");
Hammer.SetActive(true);
isEquipped = false;
}```
wouldn't gravity be the thing doing the dropping?
time to do it then xD
yep
Anyway if you want it at the player's foot position just do that:
transform.position = new Vector3(Player.position.x, 0, Player.position.z);```
thats what im doing its not working
What did the logs print?
I'm assuming the parenting has something to do with it (local vs world position)
yup exactly what I thought earlier
logs dont print anything weirdly
Can you show the logs?
yeah sure one secx
sex
ooh wait okay nvm they do
when i dropped the ball i got this
so that would suggest the ball is going to where it should...
but its not
same position in the world
I think you're missing a $ with the first log message
im always missing $
amen
Can you show an image of your code? (that if statement)
an image or do u just want me to send it
I'm curious why the second log doesn't have the same values as the first, relative to ball/player.
{
if (isEquipped)
{
Debug.Log($"Initial: Ball position {transform.position}, Player position {Player.position}");
transform.position = new Vector3(Player.position.x, 2, Player.position.y);
Debug.Log($"Changed: Ball position {transform.position}");
transform.parent = null;
Debug.Log($"Unparented: Ball position {transform.position}");
Hammer.SetActive(true);
isEquipped = false;
}
else if (distanceToPlayer.magnitude <= PickupRange)
{
transform.position = Balla.position;
transform.parent = Balla.transform;
Hammer.SetActive(false);
isEquipped = true;
}
}```
heres the whole thing
Ah, y = 2. Okay, that's fine. Why'd the z value differ though?
i really just dont understand why this code isnt working tbh
are you sure the reference inside the inspector is the correct Player transform
even if i put a transform at the players feet that still wouldnt work right? becausei would set the ball to that transform but since that transform is just always on the player the same issue would be present
I think you meant to put (Player.position.x, 2, Player.position.z)
oh they did the same mistake as earlier lol
yeah i fixed that
dont send old code then
because i copied that from someone else who copied it from my earlier code
yeah mb
we need Updated script
yep
is the parent = null working ?
because from the video it didnt seem so
Show the inspector
is this on the player or the ball ?
the ball
Is Player, the player object in the scene?
yes
and does it always spawn it at the same spot ? even if wrong ? or does it move if player moves
As of right now, it looks like you're just parenting/unparenting the object.
i believe so but ill double check
With no displacement done at all.
yep always spawns at same spot
thats what transform.position = new Vector3(Player.position.x, 2, Player.position.z); is for
to put the ball at that position
the pickup works fine though ? from your vid the ball is always parented to player
pickup works fine. when i drop the ball it becoems unparented
in the video it didnt thats why im confused
well it does now so
do you want me to send a new video or sum
how could the if statement not be true if the fireball 100% has a fireball component
if (isEquipped)
{
Debug.Log($"Click me to see the Ball highlighted: {name}", this);
Debug.Log($"Click me to see the Player highlighted: {Player.name}", Player);
transform.position = new Vector3(Player.position.x, 2, Player.position.z);
transform.parent = null;
Hammer.SetActive(true);
isEquipped = false;
}```Try this and see which objects are highlighted
Which if statement?
show the fireball component
inspector + hierarchy
when top debug highlights the ball, bottom one highlights the player
the else if
is this what its supposed to do?
I have reason to believe whatever you've referenced as Player doesn't move...
Assuming that you've referenced an unmoving object, let's opt to just drop the ball where it is rather than where this "player" is.cs if (isEquipped) { var position = transform.position; position.y = 2; transform.position = position; transform.SetParent(null, true);//Do not change the current position Hammer.SetActive(true); isEquipped = false; }
alright but the player is moving
i tried the code it still just goes back to its starting location
Debug.Log($"We hit: {collision.gameObject.name}", this);```Try this and click on the message
Are you saving?
Do you've got another script moving the ball?
Show the entire script
yes
on which line
before the if statment, ye?
wiat im dumb
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class BallPickup : MonoBehaviour
{
public GameObject PickupText;
public GameObject Hammer;
public Transform hammer;
public Transform Balla;
public Transform Player;
public float PickupRange = 5;
public bool isEquipped = false;
// Start is called before the first frame update
void Awake()
{
}
// Update is called once per frame
void Update()
{
Vector3 distanceToPlayer = Balla.position - transform.position;
if (distanceToPlayer.magnitude <= PickupRange && transform.parent != Balla.transform)
{
PickupText.SetActive(true);
}
else { PickupText.SetActive(false); }
if (Input.GetKeyDown("e"))
{
if (isEquipped)
{
var position = transform.position;
position.y = 2;
transform.position = position;
transform.SetParent(null, true);//Do not change the current position
Hammer.SetActive(true);
isEquipped = false;
}
else if (distanceToPlayer.magnitude <= PickupRange)
{
transform.position = Balla.position;
transform.parent = Balla.transform;
Hammer.SetActive(false);
isEquipped = true;
}
}
}
}```
okay there
bro use pastemod
whats that
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Use one of the links below to paste large code blocks
A tool for sharing your source code with the world!
Save, then paste the link here.
wait so on which message?
cuz one for the fireball doesnt pop up
just for the other collisions
Are you saying Fireball never hit the object?
If this script is on the object hit by the fireball, docs Debug.Log($"We were hit by: {collision.gameObject.name}", collision.collider);
yea
are there any issues with my script u can point out
it doesnt hit the fireball
So you aren't getting physics messages with the fireball https://unity.huh.how/physics-messages
yes
Your logs have been showing that the ball has moved so the issue is with something else.
#💻┃code-beginner message (ball moved to -7.62, 2, 1.52)
#💻┃code-beginner message (ball moved to -3.66, 2, 1.52)
the only other code relation to the ball is a ball attack animation
should i send my movement script or something?
ohboy..
is ballattack animation animating transform?
I meant in the animator / animation window
oh
Show us your logs @scarlet skiff
so what do u want me to check
are you animating the Transform? for the ball
yes
then there is your answer
the animation moves the ball forward and back
i dont understand how that could be messing with the other code
Animator is overriding the property for position
o... kay?
you can untick it if you want
untick what
Write Defaults
no fireballs
okay i unticked that on the animation state in the animator
still having the same problem where the ball doesnt drop by the players feet
So it isn't that your Fireball doesn't have it's component. It's that you are never hitting the Fireball to begin with
disabling Write Defaults doesn't stop it from overwriting the properties.
all it does is change whether it goes back to the original value or keep the existing value
Ohh thats not it? hmm I havent worked much animating props
no its not that
The animator will write to every single property that any animation clip in any of its states control.
It doesn't "give them up"
but animator is def overriding their position
here is the firebal lprefsb with component..
and even if i switch to the fireball tag instead.. same thing..
it doesnt even register the fireball for osme reason..
can you try with Animator disabled for ball
There were no logs that said you were hit by the Fireball. If you cannot be hit or have not been hit by the Fireball, you'll not get any physics messages.
now ofc the melee animation doesnt play
The else if statement isn't ever true because the Fireball never hit you.
so how can i make it so the animator doesnt override the position
disable it before you drop
and enable when you need it again
is there not an easier way?
thought that was pretty easy lol
i mean it is but
idk i just feel like there should be some built in way to do that
I'm not sure of it , I dont work with Animator beyond playing my mixamo animations xD
bro yesss but why, how do i fix THAT
:)
Not sure, it really isn't a coding question.
Did you ever re-enable collisions after you disabled them earlier
removed the part that disabled them fro mthe script
and made it layer based instead
It's to do with your setup.
how could the if statement not be true if the fireball 100% has a fireball component
The above was an X/Y question where the problem isn't that the object 100% has the component but rather that no collision is occurring at all.
and penta checked if the layers for the player and the fireball can interact
Share the updated scripts
A tool for sharing your source code with the world!
A tool for sharing your source code with the world!
Can you show the entire inspector including layers (near the top)?
And the player's inspector?
i think the player is unrelated in this but
Could you use a better bin site, this one just keeps coming up with blank pages or giving me errors when I try to open them. Try gdl.space at least for now
their servers seem to be having a fit at the moment
Hello I have an issue with my script that caused an error in my console. So basically my goal was to make a gun pick up system where there are two guns, one a prop gun that will just be staying on the ground waiting for the player to collide with it and a real pistol that is alredy a child of the player but will only work and appear when the player touches the fake/prop gun. And when I was making the if statement where if space is pressed and the real gun game object is set active (so it appears in the player) it will shoot, else it will not shoot. But I got an error saying that "Operator '&&' cannot be applied to operands of type 'bool' and 'void' " knowing rn that it doesnt work I am looking for an alternative way to achieve what I wanted from the start, so could somebody help?
the script:
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using UnityEngine;
public class GunEquip : MonoBehaviour
{
public GameObject propPistol;
public GameObject Pistol;
public bool showRealPewPew;
void Start()
{
Pistol.gameObject.SetActive(false);
propPistol.gameObject.SetActive(true);
}
void Update()
{
if(Input.GetKeyDown(KeyCode.Space) && Pistol.gameObject.SetActive(true))
{
Shooting();
}
else
{
NoShooting();
}
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.tag == "Pistol")
{
PickUp();
}
}
public void PickUp()
{
Pistol.gameObject.SetActive(true);
Destroy(propPistol);
}
public void Shooting()
{
}
public void NoShooting()
{
}
}
Configure your !ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code
• JetBrains Rider
• Other/None
Okay, so, the fireball starts on the Enemy Projectile layer, meaning it is not going to interact with Enemy. When the player reflects it, it becomes a Player Projectile and reverses direction, which should allow it to hit the Enemy, but it is not. Is that the gist of what's going on?
SetActive does not have a return value. I am not sure why you're trying to and it with an input boolean
yes
Let's see if it's the layers causing the problems. Re-enable the Enemy Projectile collisions with Enemy, and in the section where you check for the Fireball script, instead of destroying things, add this log:
Debug.Log($"{gameObject.name} has been hit by {collision.gameObject.name} on layer {LayerMask.LayerToName(collision.gameObject.layer)}",this);
It should fire off a message when you first fire the projectile, and then another one when it's reflected back. If there are logs, then your issue is with layer management. If there are no logs, your issue is with colliders.
I want so that the player to be able to shoot when he clicks space and have pistol game object = true, that's what I want. I'm damn new to coding and I don't really know c# fully.
thats not how you check for active object
you should def configure your IDE first before anything
ok
aight so now i run da game
Yep
I have code that is meant to stop the particle system when a certain condition is met, but for some reason my sprint particles are just playing endlessly, even when the print is happening
dam still diesnt interact with the fireball
what the hell could i have possibly forgotten/done wrong 😭
So if it gets no logs whatsoever, then that means the issue lies with your collider setup
Show the colliders and rigidbodies on this object and the fireball
there r logs, just no fireball logs
Right, so since this object never collided with any object that has the Fireball component, then that means the issue was not the layers
the layers were working fine
meaning the issue is with the colliders
Hm, neither are triggers, both are dynamic rigidbodies, both have 2D colliders
Are they at the same Z position?
wait no nvm
both should spawn at z 0
nothing ijn the codethat changed z pos
yup jus tdouble cheked
all z0
heeelp
Assets\pickle.cs(7,12): error CS0246: The type or namespace name 'PlayerBase' could not be found (are you missing a using directive or an assembly reference?)
do you have a type called PlayerBase
@scarlet skiff
This one might require some quick timing on the pause button (You can press Ctrl+Shift+P to pause during play mode if you need your mouse to be elsewhere for this to work)
Can you take a screenshot of your entire unity window, with the game paused, with the fireball overlapping the archer, with the fireball selected in the hierarchy and your console visible? This way I can check a whole lotta things at once for any discrepancies. I don't know what exactly I'm looking for but I might notice something
What is a PlayerBase
wut
What is a PlayerBase
umm idk
if you don't know then why are you trying to use it?
So why are you trying to use PlayerBase in code if you don't know what it is
tutorial said so
So do what the tutorial says to do
wait, they are at different layers, but not like the game layers, the sprite rendeder layers
but that shhouldnt matter, shouldnt it?
Shouldn't matter for collisions
only rendering
ok so picture of heirchy + inspecotr while the reflected fireball is insuide the archer?
Try that whole screen thing I suggested. I don't know a specific thing to look at but maybe if I have the whole picture I can find something amiss
Yep. The whole window, everything you can fit in
Dang the timing is hella hard
now what?
Assets\pickle.cs(29,115): error CS0019: Operator '*' cannot be applied to operands of type 'Vector2' and 'double'
cant i just move a reflected fireball into the archer or sum
You cannot multiply a Vector2 and a double
but then id have to unpause n pause
It doesn't even need to be reflected, we've found that it's not even detecting it before reflecting
1.23 is a literal value. Its type is double.
1.23f is a literal value. Its type is float.
double is more precise than float. It's also slower, so Unity uses float all over the place.
wiat wtffff why the hell does it turn into a is trigger???
Ah, I missed that
Looks like a vestige from a previous attempt to solve this problem
im gonna uninstall myself
I think the layer based approach is better so you can probably remove that
Assets\pickle.cs(29,134): error CS1002: ; expected
Look at the line underlined red in your IDE and fix the problem
what script was that
Fireball
ide?
your code editor. !IDE 👇
the thing you type code in
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code
• JetBrains Rider
• Other/None
yea i have visual studio and no underlines
then you need to configure it
using the guide linked above
where is the unity editor?
ok......BUT WHERE???
where what
im having this issue where if i start the animation for swinging the hammer, pickup the ball, and then drop the ball the hammer stays in that rotation and breaks. im trying to make it so whenever you pick up the ball it sets the hammer to its correct rotation before but its just not working. any ideas on how to help?
wait nvm i got it
Follow every step in the guide you were linked to.
ok jeez
let me know if theres any other information i can provide to help
i was considering posting this in #🏃┃animation but i thought the solution would probably be in code so i put it here
if there is some option i can tick in the animator or sum lmk tho
nice
Can someone explain to me how PolygonCollider2D.setPath(int, Vector2[]) works please? I don't understand how setting a different start index would change the shape.
guys it might be a dumb question, but how do i fix memory leaks? https://gyazo.com/faebb8d118d4085d6f1d69aa3f3273d3 i think that's what's causing garbage collector to takes many resources and let my game drop fps sometimes
https://docs.unity3d.com/Packages/com.unity.memoryprofiler@1.1/manual/find-memory-leaks.html try your luck with it.
ty i'll try
any clue someone?
https://docs.unity3d.com/ScriptReference/PolygonCollider2D.SetPath.html
A path is a cyclic sequence of line segments between points that define the outline of the polygon. Because the polygon can have holes and discontinuous parts, its shape is not necessarily defined by a single path. For example, the polygon might actually be 3 separate paths. In this case SetPath will be called 3 times, with an index of 0, 1 and 2. So index specifies which of these three collections of points are used.
It's which of the paths you want to change to the given array of vertices. If your shape is fully continuous, then the only path will be at index 0. You can change that path to whatever you want by passing in the index of 0 and the list of points that define it, in order
Memory Profiler was better in some of the earlier versions. U were able to see the memory block by block. But now, they removed that tab because it was really too cool feature to be continuously upgraded and bet they didn't wanted to give us that for free.
First off, you should consider using Mathf.Abs to make those checks easier to read.
Second, have you considered logging xPosition to see what the numbers end up being and if they line up with what you expect?
ye i'm trying to use it as much as i can but i'm not getting much out of it. Copy-pasting into chat gpt the thing that is taking up a lot of resources isn't working that well either
Can lambdas be used to convert an array of objects into an array of their stored information, or is that only lists?
aight i solved it the checks for xpos sucked
i suppose
if (7 < Mathf.abs(xPosition))
would be a better way?
just checking one more time if anyone could solve my problem, if not all good
Assets\pickle.cs(21,29): error CS0200: Property or indexer 'Vector2.up' cannot be assigned to -- it is read only
heeelp
You cannot assign a value to Vector2.up
You should consider actually reading your errors
they give you pretty good information
what do u call the thinie where u check a bool and use liek a question mark as a simpler if/else statment
ternary operator?
thanks chief
You're trying to assign to up which is read only
how large are those "GC Allocated in Frame" peaks?
Says "I didn't assign a value"
Shows a line clearly assigning a value
They are the red spikes in the Memory section.
i dont need a "break;" here, do i?
break would end the foreach early. If you don't need to keep checking other parameters, you can break
"I did it exactly like the tutorial so why does theirs work and mine doesn't" counter:
Number of times it wasn't exactly like the tutorial: 142
Number of times it was exactly like the tutorial: 5
Number of times the code literally did not exist: 1
2022-07-19 to 2024-2-05
Man it's actually been a while
like, three weeks
note that this code unconditionally sets lastAnimation and canIdle, then breaks, as long as animator.GetBool returns true
not sure if that's what you meant to do
man
ah, you're playing the animation if it isn't already playing, then noting that you can't idle and breaking. i think that makes sense!
ook==k someone tell me whats wrong
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class pickle: MonoBehaviour
{
public Rigidbody2D rb2d;
public BoxCollider2D boxCollider2d;
public float flapstrength;
void Start()
{
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space) == true)
{
rb2d.velocity = Vector2.up = flapstrength;
}
}
}
ye it sets canIdle to true, but if there is an animation to play then it set to false, at the end it chekcs if its true or not and if it is, it plays that animation
as for last animation, ye it sets what the current animation is basically
find a less blurry tutorial #💻┃code-beginner message
that is not an equals sign.
Don't try to assign a value to Vector2.up
its not blurry i screenshoted it from video
it's blurry enough that you misread it
Share the actual tutorial
and timestamp
Presumably you haven't saved, or have compiler errors
Okey, I took a really long time to answer (kinda busy sry), but I think I should do this right since you took your time to help me. I compiled the code before leaving, give it a try as you said and the documentation supports, I compiled it and tested it; it did literally nothing, don't know why, the behaviour was exactly the same. So I dediced to leave there for the time being and went out for the day. NOW I have come back and decided to test it again, it wasn't working but like it was doing nothing at all, so the issue was different, I checked the code again and... the method was empty (wtf?) Like I dunno what happened there, I rewrited it again following the guides and now it works as intended. So yeah just here to say thxs and sry for being kinda of an asshole 😄
The referenced script (Unknown) on this Behaviour is missing!
Also just to let it closed, this is how it ended
game desinging more like erorr designing
You've got an invalid script somewhere
Somehow I came help but imagine a goose trying to code😅
Does the file name and class name match
umm which class name
Whichever is failing.
The file name needs to match the name of the class inside it
how can i delete this?
you can remove a component by right-clicking on it
oh right, ty
if I instantiate an item using a scriptable object, and then change a variable in the scriptable object script, will that change all items using that scriptable object or just the one being changed?

like, if the object is item(clone) and the data is itemdata, would item(clone).itemData.height change the variable for all itemData items or just the one
References to other Unity objects are preserved.
They aren't recursively instantiated.
Thankfully it's gone on newer unity versions
How new?
(except for references to other components in your own prefab, naturally)
I just fixed a typo'd file name in a 2023.2.2f1 project today
it was wrong for a while lol
...huh
It is relatively new versions only, yeah
Yea the file name doesn't have to match the class name now
Not sure since which version
I'm guessing that, if there's only one MonoBehaviour or ScripatbleObject in the file, it just uses whatever's there
who knows what happens if two are present
2023+
The second class will not be addable by the user interface
and is only interactable via code
makes sense
Imo the old rule is a good one, but I'm glad it's not strictly enforced
There's little to no reason to have it another way
allowing the names to differ does make it very obvious that Unity doesn't actually care about the C# class (other than when it needs to actually instantiate it)
it just cares about the script asset
Hey, I'm trying to spawn spheres randomly in a 5x5 grid, but they only spawn in a diagonal line like shown. Is my logic wrong somewhere?
ook i fixed it
indeed
You pick one random number and use it for both axes
you call RandomGrid() exactly once
i can now progress cooking
Oh 💀 thanks
Now I am seeing a issue I did not see before, like I have an enemy with a NavMeshAgent that is meant to follow the player and the speed of it changes overtime dependeing of whatever the enemy in question is doing, the thing is, they should reach a point at which they are faster than the player and inevitabilly reach it even if the player is moving like the player speed is 10 and the enemy speed ramps from 5 to up to 15 and this is actually showing properly in the NavMeshAgent, but they never quite reach the player unless they stop, they stay literally one pixel away from colliding with it. I assume this has to do with the Stopping distance but... doesn't seem to do anything if I change so... is anything that prevents the agent to collide with its target or....
Could probably be the delay between setting the destination, calculating the path and actually following it. By the time the path is ready, the player has moved to a different position, so the agent is kind of always a step behind.
That's just a guess though. It's hard to say what the real reason is without proper debugging.
Should I try to calculate the player expeceted position then?
Like where is he going to be next frame or something like that
Maybe. That might work as a walk-around though concealing the real issue(in case I was wrong).
I mean, the destination is set every frame, is just an Update
Yeah, but the update order matters
If the enemy tries to move to the player, and then the player moves, it'll be off by one frame
I'd just make the enemy have a long enough reach to hit the player with a little bit of leeway
I do have the enemy "lead" the player a little in my game. That makes the enemy look a bit less single-minded.
The agent doesn't start moving towards the destination immediately. Unity calculates the path in the background which can take up to several frames.
I've had problems where an enemy stopped moving entirely -- it took more than one frame to decide on a path, and I was setting the destination every frame
oops
Yeah, that's a common problem
It was taking so long because the destination was unreachable
I mean, if it gets close enough is fine, it doesn't have to be pixel perfect, but it seems like it is stopping just outside the collision treshold, which seems like really weird
Maybe is a coincidence though and is something else that just happens to be set excatly at that value
I mean, if it is unreacheable for the agent to not move at all is kinda within the expected responses
It tries to move as close as possible.
Yeah, I kinda want to do more complex enemy behaviours in the future, this is literally just the first one; that's why I want to get it rigth as simple as it might be
actually, I just checked and I disabled that behavior 🫠
i should put it back in
i think it was causing weird problems when the enemy was really far away
it'd try to lead you by 30 seconds and just...go somewhere weird
Oh, nevermind, reducing the radius of obstacle avoidance seems to do the job
Which is weird, the player is nor an obstacle nor agent, so I don't know why they are trying to avoid as an obstacle
It seems like avoidance includes colliders as well.
That seems potentially troublesome in the future
how do i do cooldowns
like how do i make it so something can only happen if it happened more then 5 seconds ago
A timer in update or cache the last use time
how do i cache the last use time
how tf do i make a boss battle lmao
should i use animationcontrollers
it seems kinda scuffed
Hello guys, I have a difficulty getting my bullet to move while the player moves. Help
lastTimeUsed = timeNow;
🤷♂️
I don't think people will help without context.
when do i cache it
because i tried cacheing it every time the ability is used but that doesnt seem to work
it just never is able to be used again
i set timenow to Time.deltaTime should that be different
make em member variables so they dont fall out of scope
me?
ye
how
by making member variables ;o
yeah how do i do that
Maybe ask which terminology you aren't understanding
im confused on member variables how do i make one of those
You know those stuff up top with public, private, protected and whatnot that aren't methods?
Move your variable up there and it'll exist within the scope of the entire class instance
i have it up there
float move1lastTimeUsed;
float move2lastTimeUsed;
float move1cooldown = 3f;
float move2cooldown = 5f;
thats at the top
public void Ability1(InputAction.CallbackContext ctx)
{
if (IsOwner)
{
if (ctx.performed)
{
if (Time.deltaTime - move1lastTimeUsed >= move1cooldown)
{
if (playerController.Skin == 1)
{
HiddenMistSlash();
}
else if (playerController.Skin == 2)
{
Invisible();
}
else if (playerController.Skin == 3)
{
ShieldBash();
}
else if (playerController.Skin == 4)
{
Subscribe();
}
else if (playerController.Skin == 5)
{
BatterBlitz();
}
move1lastTimeUsed = Time.deltaTime;
Debug.Log(move1lastTimeUsed);
}
}
}
}
thats the first abilitys code
Maybe you were wanting Time.time rather than delta time?
well wouldnt that mess it up if its ran at different frame rates
Um, the above would never happen if delta time is small
It's not the accumulation of deltas but the delta this frame (which is a tiny number)
When you use it.
Normal time stamp timers would becs current = Time.time; if(current > next) { ... do stuff next = current + delay; }
works now thanks
deltatime would work if you compound assign the time passed, but using real time you can just compare from previous time used
AHHHHhhh 
what?
that is a terrible mentality to code with
that is how you write yourself into a terrible position
//deltaTime way
if (elapsedTime < cooldownDuration)
{
elapsedTime += Time.deltaTime;
}
else
{
DoAbility();
elapsedTime = 0.0f;
}```
if you know you are doing it poorly, do better
yes but then i have to remake it
if it aint broke dont fix it
have you ever heard of refactoring?
it’s literally redoing something that isn’t broken.
if i ever do smth like this again i would use enums or switch-case as i now have learned about them but i dont really have the time to change something that is working fine for what i need it for
it's w/e, but your ide will convert it to switch for you if you right click on the statement and convert it automatically
and even further into a pattern matching statement
which offers not actual improvement but looks cleaner
yeah thats why i decided not to change how im currently doing it because for no actualy improvements its not worth the time changing it when i could be doing other stuff
im not saying i would do it the way im doing it now again i would definitly change to another way but i just dont have the time to change my current way
im saying it will do it for you though since you've got it set up in a way that it will
also this doesnt seem to be working for me
if (move2lastTimeUsed < move2cooldown)
{
move2lastTimeUsed += Time.deltaTime;
}
else
{
if (playerController.Skin == 1)
{
Dash();
}
else if (playerController.Skin == 2)
{
WizardDash();
}
else if (playerController.Skin == 3)
{
SwordSlash();
}
else if (playerController.Skin == 4)
{
Like();
}
else if (playerController.Skin == 5)
{
SyrupySplatdown();
}
move2lastTimeUsed = 0.0f;
}
you cant use deltatime here
if you're doing it by the input system because it doesnt exist in update
so you have to check by previously used time
ok
well, you can use it but you must append the delta value inside of update, because in this case you're only incrementing values whenever you press the key
What's the most popular way to apply a turning force to a 3d character, like if they're moving fast in one direction that any additional acceleration in another direction will only turn them gradually so you need to apply an extra force to rotate them to that direction?
i mean i dont have a option to change the fps so i dont think it really changes much
right or will it matter
my current idea is to use a vector dot product to check if the current velocity vector is pointing in the same direction as the players input and then multiple the current acceleration by the difference between the two angles.
Unless you're an engineer (which is what coding is. Software engineering). If you are, something working is an opportunity to break it and make it better
Actually since the dot product equals 1 when the vectors are alligned, I should be multiplying it by 1-dot product
and i agree with that but i dont have the most time to work on my game and if it doesnt improve it to people playing the game then its not worth it to me to change it because i would then be wasting time i could be either fixing stuff that actually affects gameplay or adding more stuff
I feel like this specifically would make it better for the people playing, because it would make it easier to develop and give you more time to add features instead of tip toeing around the brittle architecture
But it's all good
I want sorting Y pos for my top-down game, it's affected to canvas UI element ?
“if it aint broke don’t fix it” does not apply to coding, because code that “works” is perfectly capable of hurting you
if they're enums why is this all just using unreadable numbers
I love it when my type is 3
lol
this is more like a draft now
there are tons of rules that i need to think of
annnnnd this code is in a switch case , so its not hard to reference it lol
seems odd that this is in a switch and you still need to check values like this
If the loop continue if bet result is not 3 6 7 so why you check if the bet result is 1 or 2
should label your stuff more
betResult.type.IsWhatever() instead of checking like this
and abstract away this crap
use enums instead of explicitly binding values to represent some references and whatnot
Also (a and b) or b is b
Solution didn't work out fully, ended up just turning up the drag which seemed to fix the problem mostly, still not turning as fast as I'd want but close enough for now
I got an issue with the camera and the player body not syncing up correctly when turning. Ive troubleshooted it down to this block of code. What math do i have wrong here? (the camera is not a child object of the player)
public void OnLook(InputAction.CallbackContext context)
{
view = context.ReadValue<Vector2>();
yRotation += view.x * 0.1f * sensX;
xRotation -= view.y * 0.1f * sensY;
xRotation = Mathf.Clamp(xRotation, -45f, 45f);
cameraPosition.localEulerAngles = new Vector3(xRotation, yRotation, 0f);
playerRotation = new Vector3(0f, yRotation, 0f);
Quaternion deltaRotation = Quaternion.Euler(playerRotation * Time.fixedDeltaTime);
rb.MoveRotation(rb.rotation * deltaRotation);
}
I don't think you're using MoveRotation correctly. Did you read the docs page?
I think I gave you a suggestion how to change it yesterday. Did you give it a try?
i did yesterday, and i believe we changed transform.Rotate() to rb.MoveRotation bc it is a smooth movement between rotation vectors
I can see some other issues too. Like calling MoveRotation from an input callback instead of fixed update.
i changed that a second ago, i am now just being a bit destructive trying to find out whats goin on
ok so im coding for the first time in microsoft visual studio, and there are some errors in my movement script, and i would like help fixing
Yes, but I also suggested to keep track of your rotation in a variable, adjust it and pass it to the MoveRotation, instead of the weird delta calculation that you're doing.
Start from reading the errors
those are the ones with the red underline right
ohhh yea i think i got distracted and ended up goin to bed, so your saying instead of rb.MoveRotation(rb.rotation * deltaRotation); I should calculate rb.rotation * deltaRotation seperately?
What's the rotation * deltaRotation even for? Can you explain the intention behind it?
Yes. Them. Read the error message.
yea its incredibly hard to follow, rb.rotation * deltaRotation is basically multiplying the Y rotation of the input to Time.fixedDeltaTime. Then that has to be a quaternion to go into MoveRotation.
im about to just restart the entire script. I keep changing it anyways
It's not just hard to follow, it makes little sense to me in the first place.
hahahaha
Like, can you explain the logic step by step?
yea i know about the components, what they do mostly, but then its "how do i put this together? ill watch a vid on it" and they have the worst code... but your already 20 minutes in and i dont really know a different way of rotating the camera and player with the new input system..
the documentation has some good examples, but i think i used the moveRotation example unity had and it was the rotation * deltaRotation stuff, with the quaternion
First of all, the input system shouldn't really matter here. You're just querying input in a different way. The numbers are the same. It shouldn't have any effect on the game logic at all.
your right, its just a vector2 i can split with .x and .y
okay so mapping the input is fine, so my problem is with rotations in general lol
Indeed they have. Except that the value that they use for delta rotation is different from what you have. They use a rotation velocity. You on the other hand use the final rotation in angles, which doesn't make sense.
is rotation velocity the difference from the first call to the second?
If you want to use the final rotation(which is correct in this case), you need to feed it into move rotation directly(after converting to a quaternion), instead of doing any math on it.
No. If you look at their example properly, you'll see that it's a constant that they define in code.
There's even a comment describing what the code does.
Rotating around y axis, 100 deg/sec
Which is not exactly what you want. You should use the example as a reference to understand the API, not apply it to your code directly.
ohh yea, i changed that to the YRotation
so I was using the YRotation as a degree per second
Yes.
No. Start simpler. What does MoveRotation method take?
a Quaternion 😄
Not the type. What does it represent?
a vector3?
No. It's in the docs. Just read it.
the new rotation for the RigidBody 😮
This only represents the rotation on the Y axis.
playerRotation
Correct
do i have to worry about Time.fixedDeltaTime with the MoveRotation or the playerRotation?
i would think no because its not moving the player... but im not sure if i have to calculate it beforehand.. but seeing the MoveRotation method doesnt take the Time.fixedDeltaTime function i guess no?
also i know the new input system normalizes the movement already, I didnt know if it dealt with the time or not
Think simpler. What does MoveRotation do?
rotates the rb
ohh hey i fixed it somewhat,
rb.MoveRotation(deltaRotation);```
it can now move in the right direction and rotate correctly, but it still doesnt constantly update the direction im moving in until i click w again
oh yay its all working now, thanks mr dlich
One thing about naming your variables. What does "deltaRotation" in your code represent actually?
nothin, i just copied most of the document
It's not nothing. As long as it serves a purpose in your code, it does represent something.
What does it represent?
i renamed it playerRot, as in MoveRotation(Quaternion rot)
Good. Naming your methods and variables correctly is very important, both to assist you in understanding your code and even more so when you ask other people for help and share code with them.
i want to optimize it to look like the old input system unity asset that has the fps for you
like i have code that "just works" that looks like
yRotation += view.x * 0.1f * sensX;
xRotation -= view.y * 0.1f * sensY;```
Okay?
Not sure I understand what you're trying to say.
But I'd get rid of that 0.1f magic number in there.
idk what that means or how the math is correct when doing -= or +=.
Why even have it? You already have sensitivity
i think i had it set in the thousands or something rediculous
The minus equals is to make the view not inverted
Yeah, it had to be raised to a factor of 10 I guess.
By removing the 0.1, you can avoid that
its at 1 sens rn and super fast
Nice, way more reasonable. Now you can put it at like .5 or something
then you have to be more precise when changing it in the editor
so like .01 i could then have a sensitivity on a menu reasonable from 0-10 or something
Does anyone know how to make it so when a particle touches an object with a tag it runs a method that’s inside of the object it touched
i have output[output.Length - 1] = element; line and editor says that it can be simplified to output[^1] = element; i want to use it but i fear ill forget about it, what is this ^1 called ?
perhaps if i know more ill be able to recall it later
This should be factored in in the UI then, not in the internal representation of the value. But if you really want to keep the magic number, at least make it a const and name it appropriately.
The language supports indices and ranges
https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/ranges-indexes
I'd guess you could call it the "Index from end operator ^"..
does scale matter when dealing with rigidbodies? im trying to crouch
this isn't a code question
with what
oops wrong server
how do i make the character not get stuck on the edge of a platform?
i tried a physical material and it works somewhat i think, but it still is an issue
What's the cause?
im not sure, probably the raycast thinking its the ground
i got bigger fish to fry in the #🖱️┃input-system chat. Jeez im causing fires left and right
Well, then find out the cause first before trying to fix something you don't completely understand.
yea its not the top priority atm, i can live with it
rn im tryin to fix this weird ghost code
It doesn't seem to be specifically input system related, so maybe move it here. And I didn't understand what the issue is from the message in the other channel.
in the inspector, you can see that sprinting changes the Move Speed from 2 to 3, But crouching does everything it needs to BUT change the move speed
i can even debug the speed in the If statements and it changes accordingly, just not the actual speed fsr
I don't see anything changing aside from the bools in that video.🤷♂️
this shows it better
im thinking now that the code for the crouch method is sound, but whatever is actually moving the player isnt updating the moveSpeed variable?
Share the code
When you debug issues like this, you'd typically log every time the variable is changed and the new value. This way you'd see if crouching changes the value at all, or if something is overwriting it.
ill have to lookup a video on some debugging, all i know is strings and sometimes values
Heh, I was trying to not get too annoyed when seeing this:
if (isCrouched)
{
}
else if (!isCrouched)
ok,
hahaha are you talking about not using : and ? or because the else if is unnecessary?
The else if is unnecessary
idk, a new term
code that compiles and doesnt work?
oh ok
everything that seems to show that its working, but still doesnt lol
it just kinda poofs
Where did you see that?
someone was talking about it earlier
here ill reply to it
wasd
i wonder who
Ah, they just come up with a name for it.
isnt there some kind of phase or enum i could code to do this instead of coding out each method in a different way?
yeah that makes sense
i forgot what its called
im pretty sure
Wdym?
What are you referring to?
Explain in words please.
check for a key press and change the speed on the press
no the MovementState. stuff
Assuming you want only one state active at the same time, a state machine with enums is a good option, yeah.
Except that they don't represent one state and prone to bugs.
what gives it away
If you have one variable for the current state, you physically can't be in 2 states, which makes it easier to debug.
wheres isCrouched
inspector
oh ok
dude how many times am i gonna have to alter this script
at least it makes me feel better you guys been thru this
plus another 3 for every 2 changes
How long have you been working on it?
Hello, I wanted to know, I am making my game in VR like PC building Simulator, I placed my objects in the right place, except that I always have the elements in red and blue as in the photo and I wanted to know if it Is this an option to check or not?
It seems to me it's a box to uncheck in the preview but I don't know where it is.
Ive been really just learning absolutely everything about movement, and got fed up for not konwing how to do it myself, I started this script yesturday
i honestly have no clue whats happening in this image
hahaha i thought he was looking down in a pond reflection but also into the top of a house
damn
then i saw the hands then i was like oh its vr and thats a navigation dot
That's very little time, especially for a beginner. A project I'm working on at work still has bugs pop up 6 years after release.
I have my objects which fit into the PC case but I still see the shape of the objects (in red and blue), but I don't know how to explain
fair enough
like an outline
you have to SetActive(gameobject, false) when the trigger is hit
^what he said
ty
it's as if the collisions were buggy between them and it's a preview and I would like to remove it
gameObject.SetActive(false);
how does one stick to a game that long, and also find joy out of it?
Unity moment
I put it in each script of each object?
Money. You don't ask your tasks at work.
yea i doubt ill get close to making money out of this, at least for another 10 years
Though I do enjoy debugging. You learn to do it at some point. It's like a puzzle game. Food for the brain.
i cant stop. I only slept 1 hour yesturday and now its 1:20 and i got work today
i got adhd i do it with everything
fair enough
ill take care of myself today, thanks for the help guys
i have reason to believe i have autism (getting tested soon), and i tend to do the same
all good
now go have fun
public void amountThatIsActive(Values values)
{
}
why doesnt that appear in a button onclick
forgot to mention Values is an enum
its already bad enough that the inspector only supports a void with one parameter
😭
ill do it tmrw i decided to gtb after i asked thinking you would just know lol
like turned the pc off and everything
the script literally has a public enum with 8 options and that void statement i didnt do anything else with it
having the whole script would really help with debugging
ok
the command deactivates my objects, they are no longer in the scene, but I need the objects, it's just the preview that I want to remove (in red and blue)
so filter it to remove the preview instead
filter? how to do that?
Did you drag in the script or an object with the script on it
guys if 2 colliders touch without scripts will they just collide?
A rigidbody will not move through a solid collider
i love ur name @tepid summit
this ?
yeah but like for scripting
I'm in VR so I only have the XR Plugin scripts (XR Socket interactor, XR Grab interable)
and the XR Interaction Manager
ok
and I try to look on the internet or even settings but I can't find
i dont work with vr so i cant help you
also theres a vr specific channel if you want to try there
#🥽┃virtual-reality this ?
im pretty sure
I thank you for your help all the same
ok
i put the script on an object then dragged the object onto the buttons onclick and the void name doesnt appear in the options
is there a specific way to use enums in void params?
What do you mean by void params?
void params, next gen of params
Void=nothing hence void param=no param?
Btw void is the type name
I think you mean method
is there a big difference between lerp and slerp? if so, what is it
lerp is linear interpolation and slerp is spherical linear interpolation
to be very simple. with a quite bad example
lerp : movement like when u take an elevator
slerp : if you jump off a cliff irl
How do you jump off a cliff spherically
Rather imagine traveling around a circle or a sphere
gravity
the arc of your jump
{
Debug.Log("Running");
}
else
{
Debug.Log("Walking");
}```
The Running Debug only works on the time you first press shift, id like it stay as you hold the key
I can see what you mean but the acceleration you get from gravity is far from spherical, mathematically